在网页上插入能自动更新的日期和时间
在网页上插入能自动更新的日期和时间
方法一:
<FONT color=#000000>
<DIV id=jnkc style="HEIGHT: 20px; text-line: 20px"></DIV></FONT>
<SCRIPT language=javascript>
weekshow="星期"+"日一二三四五六".charAt(new Date().getDay());
setInterval("jnkc.innerHTML=new Date().toLocaleString()+weekshow",1000);
</SCRIPT>
方法二:
<SCRIPT language=javascript>
<!--
function initArray()
{
for(i=0;i<initArray.arguments.length;i++)
this=initArray.arguments;
}
var isnMonths=new initArray("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
var isnDays=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");
today=new Date();
hrs=today.getHours();
min=today.getMinutes();
sec=today.getSeconds();
clckh=""+((hrs>12)?hrs-12:hrs);
clckm=((min<10)?"0":"")+min;clcks=((sec<10)?"0":"")+sec;
clck=(hrs>=12)?"下午":"上午";
var stnr="";
var ns="0123456789";
var a="";
function getFullYear(d)
{
yr=d.getYear();if(yr<1000)
yr+=1900;
return yr;
}
document.write(isnDays[today.getDay()]+","+isnMonths[today.getMonth()]+""+today.getDate()+"日,"+getFullYear(today)+"年");
//-->
</SCRIPT>
方法一:
<FONT color=#000000>
<DIV id=jnkc style="HEIGHT: 20px; text-line: 20px"></DIV></FONT>
<SCRIPT language=javascript>
weekshow="星期"+"日一二三四五六".charAt(new Date().getDay());
setInterval("jnkc.innerHTML=new Date().toLocaleString()+weekshow",1000);
</SCRIPT>
方法二:
<SCRIPT language=javascript>
<!--
function initArray()
{
for(i=0;i<initArray.arguments.length;i++)
this
}
var isnMonths=new initArray("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
var isnDays=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");
today=new Date();
hrs=today.getHours();
min=today.getMinutes();
sec=today.getSeconds();
clckh=""+((hrs>12)?hrs-12:hrs);
clckm=((min<10)?"0":"")+min;clcks=((sec<10)?"0":"")+sec;
clck=(hrs>=12)?"下午":"上午";
var stnr="";
var ns="0123456789";
var a="";
function getFullYear(d)
{
yr=d.getYear();if(yr<1000)
yr+=1900;
return yr;
}
document.write(isnDays[today.getDay()]+","+isnMonths[today.getMonth()]+""+today.getDate()+"日,"+getFullYear(today)+"年");
//-->
</SCRIPT>