欢迎光临
我们一直在努力

JAVA动态效果(1)表格时钟-JSP教程,Application/Applet

建站超值云服务器,限时71元/月

<body onload="startit()">
<script language="javascript">
<!–
var isn1=null;
var isn2=false;
today=new date();
function stopit()
{
if(isn2)
{
cleartimeout(isn1);
}
isn2=false;
}
function startit()
{
stopit();
isnclock();
}
function isnclock()
{
var now=new date();
var hrs=now.gethours();
var min=now.getminutes();
var sec=now.getseconds();
document.clckh.disp1.value=""+((hrs>12)?hrs-12:hrs);
document.clckh.disp2.value=((min<10)?"0":"")+min;
document.clckh.disp3.value=((sec<10)?"0":"")+sec;
document.clckh.disp4.value=(hrs>=12)?"下午":"上午";
isn1=settimeout("isnclock()",1000);
isn2=true;
}
function isnarray()
{
argnr=isnarray.arguments.length
for(var i=0;
i<argnr;
i++)
{
this[i+1]=isnarray.arguments[i];
}
}
var isnmonths=new isnarray("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
var isndays=new isnarray("星期一","星期二","星期三","星期四","星期五","星期六","星期日");isndays[0]="星期日";
//–>
</script>

<form name="clckh" onsubmit="0">
<table border="2">
<tr>
<td>时间</td>
<td><div align="center"><center><p>点</td>
<td align="center"><div align="center"><center><p>分</td>
<td align="center"><div align="center"><center><p>秒</td>
<td align="center"> </td>
</tr>
<tr align="center">
<td> </td>
<td valign="top"><input type="text" name="disp1" size="2"></td>
<td valign="top"><input type="text" name="disp2" size="2"></td>
<td valign="top"><input type="text" name="disp3" size="2"></td>
<td valign="top"><input type="text" name="disp4" size="3"></td>
</tr>
<script language="javascript">
<!–
var thisyear=today.getyear();
if (thisyear< 2000)
thisyear=1900+thisyear;
document.write("<tr><td>日期</td><td colspan=4>"
+isndays[today.getday()]+","+isnmonths[today.getmonth()+1]
+","+today.getdate()+"月," +thisyear+"年");
//–>
</script>

</table>
</form>  

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » JAVA动态效果(1)表格时钟-JSP教程,Application/Applet
分享到: 更多 (0)