<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-TYpe" content="text/html;charset=utf-8">
<TITLE>九九乘法表</TITLE>
</head>
<body>
<div id="dom"></div>
<div id="dom1"></div>
<div id="dom2"></div>
<script type="text/javascript" language="javascript">
function aa(){
var htmltext="<h1><B><center><h1>九九乘法表</h1></center><table align='center' border='1'>";
for(var i=1;i<10;i++){
htmltext+="<tr>";
for(var j=1;j<i+1;j++){
htmltext+="<td><h1>"+j+"*"+i+"="+(i*j)+"</h1></td>";
}
htmltext+="</tr>";
}
htmltext+="</table></h1></b>";
document.getElementById("dom").innerHTML=htmltext;
}
aa();
var _change = {
ary0:["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"],
ary1:["", "十", "百", "千"],
ary2:["", "万", "亿", "兆"],
init:function (name) {
this.name = name;
},
strrev:function () {
var ary = []
for (var i = this.name.length; i >= 0; i--) {
ary.push(this.name[i])
}
return ary.join("");
}, //倒转字符串。
pri_ary:function () {
var $this = this
var ary = this.strrev();
var zero = ""
var newary = ""
var i4 = -1
for (var i = 0; i < ary.length; i++) {
if (i % 4 == 0) { //首先判断万级单位,每隔四个字符就让万级单位数组索引号递增
i4++;
newary = this.ary2[i4] + newary; //将万级单位存入该字符的读法中去,它肯定是放在当前字符读法的末尾,所以首先将它叠加入$r中,
zero = ""; //在万级单位位置的“0”肯定是不用的读的,所以设置零的读法为空
}
//关于0的处理与判断。
if (ary[i] == '0') { //如果读出的字符是“0”,执行如下判断这个“0”是否读作“零”
switch (i % 4) {
case 0:
break;
//如果位置索引能被4整除,表示它所处位置是万级单位位置,这个位置的0的读法在前面就已经设置好了,所以这里直接跳过
case 1:
case 2:
case 3:
if (ary[i - 1] != '0') {
zero = "零"
}
; //如果不被4整除,那么都执行这段判断代码:如果它的下一位数字(针对当前字符串来说是上一个字符,因为之前执行了反转)也是0,那么跳过,否则读作“零”
break;
}
newary = zero + newary;
zero = '';
}
else { //如果不是“0”
newary = this.ary0[parseInt(ary[i])] + this.ary1[i % 4] + newary; //就将该当字符转换成数值型,并作为数组ary0的索引号,以得到与之对应的中文读法,其后再跟上它的的一级单位(空、十、百还是千)最后再加上前面已存入的读法内容。
}
}
if (newary.indexOf("零") == 0) {
newary = newary.substr(1)
}//处理前面的0
return newary;
}
}
//创建class类
function change() {
this.init.apply(this, arguments);
}
change.prototype = _change
//创建实例
var k = new change("00102040");
alert(k.pri_ary())
function aa2(){
var htmltext="<h1><B><center><h1>九九乘法表</h1></center><table align='center' border='1'>";
for(var i=1;i<10;i++){
htmltext+="<tr>";
for(var j=1;j<i+1;j++){
var k = new change("00"+i);
var k1 = new change("00"+j);
var k2 = new change("00"+i*j);
//alert(k.pri_ary())
htmltext+="<td><h1>"+k.pri_ary()+"*"+k1.pri_ary()+"="+k2.pri_ary()+"</h1></td>";
}
htmltext+="</tr>";
}
htmltext+="</table></h1></b>";
document.getElementById("dom1").innerHTML=htmltext;
}
aa2();
function NoToChinese(num) {
if (!/^\d*(\.\d*)?$/.test(num)) { alert("Number is wrong!"); return "Number is wrong!"; }
var AA = new Array("零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖");
var BB = new Array("", "拾", "佰", "仟", "萬", "億", "点", "");
var a = ("" + num).replace(/(^0*)/g, "").split("."), k = 0, re = "";
for (var i = a[0].length - 1; i >= 0; i--) {
switch (k) {
case 0: re = BB[7] + re; break;
case 4: if (!new RegExp("0{4}\\d{" + (a[0].length - i - 1) + "}$").test(a[0]))
re = BB[4] + re; break;
case 8: re = BB[5] + re; BB[7] = BB[5]; k = 0; break;
}
if (k % 4 == 2 && a[0].charAt(i + 2) != 0 && a[0].charAt(i + 1) == 0) re = AA[0] + re;
if (a[0].charAt(i) != 0) re = AA[a[0].charAt(i)] + BB[k % 4] + re; k++;
}
if (a.length > 1) //加上小数部分(如果有小数部分)
{
re += BB[6];
for (var i = 0; i < a[1].length; i++) re += AA[a[1].charAt(i)];
}
return re;
}
function aa3(){
var htmltext="<h1><B><center><h1>九九乘法表</h1></center><table align='center' border='1'>";
for(var i=1;i<10;i++){
htmltext+="<tr>";
for(var j=1;j<i+1;j++){
var k = NoToChinese(i);
var k1 = NoToChinese(j);
var k2 = NoToChinese(i*j);
//alert(k.pri_ary())
htmltext+="<td><h1>"+k+"*"+k1+"="+k2+"</h1></td>";
}
htmltext+="</tr>";
}
htmltext+="</table></h1></b>";
document.getElementById("dom2").innerHTML=htmltext;
}
aa3();
</script>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-TYpe" content="text/html;charset=utf-8">
<TITLE>九九乘法表</TITLE>
</head>
<body>
<div id="dom"></div>
<div id="dom1"></div>
<div id="dom2"></div>
<script type="text/javascript" language="javascript">
function aa(){
var htmltext="<h1><B><center><h1>九九乘法表</h1></center><table align='center' border='1'>";
for(var i=1;i<10;i++){
htmltext+="<tr>";
for(var j=1;j<i+1;j++){
htmltext+="<td><h1>"+j+"*"+i+"="+(i*j)+"</h1></td>";
}
htmltext+="</tr>";
}
htmltext+="</table></h1></b>";
document.getElementById("dom").innerHTML=htmltext;
}
aa();
var _change = {
ary0:["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"],
ary1:["", "十", "百", "千"],
ary2:["", "万", "亿", "兆"],
init:function (name) {
this.name = name;
},
strrev:function () {
var ary = []
for (var i = this.name.length; i >= 0; i--) {
ary.push(this.name[i])
}
return ary.join("");
}, //倒转字符串。
pri_ary:function () {
var $this = this
var ary = this.strrev();
var zero = ""
var newary = ""
var i4 = -1
for (var i = 0; i < ary.length; i++) {
if (i % 4 == 0) { //首先判断万级单位,每隔四个字符就让万级单位数组索引号递增
i4++;
newary = this.ary2[i4] + newary; //将万级单位存入该字符的读法中去,它肯定是放在当前字符读法的末尾,所以首先将它叠加入$r中,
zero = ""; //在万级单位位置的“0”肯定是不用的读的,所以设置零的读法为空
}
//关于0的处理与判断。
if (ary[i] == '0') { //如果读出的字符是“0”,执行如下判断这个“0”是否读作“零”
switch (i % 4) {
case 0:
break;
//如果位置索引能被4整除,表示它所处位置是万级单位位置,这个位置的0的读法在前面就已经设置好了,所以这里直接跳过
case 1:
case 2:
case 3:
if (ary[i - 1] != '0') {
zero = "零"
}
; //如果不被4整除,那么都执行这段判断代码:如果它的下一位数字(针对当前字符串来说是上一个字符,因为之前执行了反转)也是0,那么跳过,否则读作“零”
break;
}
newary = zero + newary;
zero = '';
}
else { //如果不是“0”
newary = this.ary0[parseInt(ary[i])] + this.ary1[i % 4] + newary; //就将该当字符转换成数值型,并作为数组ary0的索引号,以得到与之对应的中文读法,其后再跟上它的的一级单位(空、十、百还是千)最后再加上前面已存入的读法内容。
}
}
if (newary.indexOf("零") == 0) {
newary = newary.substr(1)
}//处理前面的0
return newary;
}
}
//创建class类
function change() {
this.init.apply(this, arguments);
}
change.prototype = _change
//创建实例
var k = new change("00102040");
alert(k.pri_ary())
function aa2(){
var htmltext="<h1><B><center><h1>九九乘法表</h1></center><table align='center' border='1'>";
for(var i=1;i<10;i++){
htmltext+="<tr>";
for(var j=1;j<i+1;j++){
var k = new change("00"+i);
var k1 = new change("00"+j);
var k2 = new change("00"+i*j);
//alert(k.pri_ary())
htmltext+="<td><h1>"+k.pri_ary()+"*"+k1.pri_ary()+"="+k2.pri_ary()+"</h1></td>";
}
htmltext+="</tr>";
}
htmltext+="</table></h1></b>";
document.getElementById("dom1").innerHTML=htmltext;
}
aa2();
function NoToChinese(num) {
if (!/^\d*(\.\d*)?$/.test(num)) { alert("Number is wrong!"); return "Number is wrong!"; }
var AA = new Array("零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖");
var BB = new Array("", "拾", "佰", "仟", "萬", "億", "点", "");
var a = ("" + num).replace(/(^0*)/g, "").split("."), k = 0, re = "";
for (var i = a[0].length - 1; i >= 0; i--) {
switch (k) {
case 0: re = BB[7] + re; break;
case 4: if (!new RegExp("0{4}\\d{" + (a[0].length - i - 1) + "}$").test(a[0]))
re = BB[4] + re; break;
case 8: re = BB[5] + re; BB[7] = BB[5]; k = 0; break;
}
if (k % 4 == 2 && a[0].charAt(i + 2) != 0 && a[0].charAt(i + 1) == 0) re = AA[0] + re;
if (a[0].charAt(i) != 0) re = AA[a[0].charAt(i)] + BB[k % 4] + re; k++;
}
if (a.length > 1) //加上小数部分(如果有小数部分)
{
re += BB[6];
for (var i = 0; i < a[1].length; i++) re += AA[a[1].charAt(i)];
}
return re;
}
function aa3(){
var htmltext="<h1><B><center><h1>九九乘法表</h1></center><table align='center' border='1'>";
for(var i=1;i<10;i++){
htmltext+="<tr>";
for(var j=1;j<i+1;j++){
var k = NoToChinese(i);
var k1 = NoToChinese(j);
var k2 = NoToChinese(i*j);
//alert(k.pri_ary())
htmltext+="<td><h1>"+k+"*"+k1+"="+k2+"</h1></td>";
}
htmltext+="</tr>";
}
htmltext+="</table></h1></b>";
document.getElementById("dom2").innerHTML=htmltext;
}
aa3();
</script>
</body>
</html>