CSDN博客

img doc123

表格显示时间

发表于2008/9/29 14:32:00  340人阅读

分类: 点点积累

 

<html>

<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>"

+thisyear+"年"

+isnMonths[today.getMonth()+1]

+""+today.getDate()+"日" +isnDays[today.getDay()]);

 

//-->

</script>

 

</table>

</form>  

</body>

</html>

 

 

0 0

相关博文

我的热门文章

img
取 消
img