<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<title>汉字时间</title>
</head>
<body>
<script defer>
function clock2(index)
{
text = "";
var hanzi = "一二三四五六七八九十";
if(index==0)
{
text = text +"零";
}
else if(index<10)
{
text = text+hanzi.substring(0+(index-1),index);
}
else if(index<20)
{
text ="十"+ text +hanzi.substring(0+(index-11),(index-10));
}
else if(index<30)
{
text ="二十"+ text+hanzi.substring(0+(index-21),(index-20));
}
else if(index<40)
{
text ="三十"+ text +hanzi.substring(0+(index-31),(index-30));
}
else if(index<50)
{
text = "四十"+text+hanzi.substring(0+(index-41),(index-40));
}
else if(index<60)
{
text ="五十"+ text +hanzi.substring(0+(index-51),(index-50));
}
return text;
}
function clock2_1() {
clocker = document.getElementById("timer2");
aaa = new Date();
hours = aaa.getHours();
min = aaa.getMinutes();
seconds= aaa.getSeconds();
clocker.innerHTML=clock2_1(hours);
}
clock2_1();
</script>
<div id="timer"></div>
<div id="timer2"></div>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<title>汉字时间</title>
</head>
<body>
<script defer>
function clock2(index)
{
text = "";
var hanzi = "一二三四五六七八九十";
if(index==0)
{
text = text +"零";
}
else if(index<10)
{
text = text+hanzi.substring(0+(index-1),index);
}
else if(index<20)
{
text ="十"+ text +hanzi.substring(0+(index-11),(index-10));
}
else if(index<30)
{
text ="二十"+ text+hanzi.substring(0+(index-21),(index-20));
}
else if(index<40)
{
text ="三十"+ text +hanzi.substring(0+(index-31),(index-30));
}
else if(index<50)
{
text = "四十"+text+hanzi.substring(0+(index-41),(index-40));
}
else if(index<60)
{
text ="五十"+ text +hanzi.substring(0+(index-51),(index-50));
}
return text;
}
function clock2_1() {
clocker = document.getElementById("timer2");
aaa = new Date();
hours = aaa.getHours();
min = aaa.getMinutes();
seconds= aaa.getSeconds();
clocker.innerHTML=clock2_1(hours);
}
clock2_1();
</script>
<div id="timer"></div>
<div id="timer2"></div>
</body>
</html>
else if(index<60)
{
text ="五十"+ text +hanzi.substring(0+(index-51),(index-50));
}
index=1,就变成text ="五十"+ text +hanzi.substring(-50,-49);