法国旅游签证按手印:请问我用frongpage编网页时怎么编好游览网页时的时间显示?

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/27 21:36:48
请问我用frongpage编网页时怎么编好游览网页时的时间显示?frongpage里的插入时间是插入的编网页时的,游览网页时不会走.
如果前面还加上年月日和星期,怎么办呢?

在<body></body>中加入如下代码:<script language="JavaScript1.2">
<!--
if (document.layers)
document.write('<ilayer id="clockmain" height=20><layer id="clock" width="100%"></layer></ilayer>');
else
document.write("<div><span id='clock'></span></div>");
var now,hours,minutes,seconds,timeValue;
function showtime(){
if (!document.layers&&!document.all) return;
now = new Date();
hours = now.getHours();
minutes = now.getMinutes();
seconds = now.getSeconds();
timeValue = (hours >= 12) ? "下午 " : "上午 ";
timeValue += ((hours > 12) ? hours - 12 : hours) + "时";
timeValue += ((minutes < 10) ? " 0" : " ") + minutes + "分";
timeValue += ((seconds < 10) ? " 0" : " ") + seconds + "秒";
if (document.layers){
document.clockmain.document.clock.document.write(timeValue);
document.clockmain.document.clock.document.close();
}
else if (document.all)
clock.innerHTML = timeValue;
setTimeout("showtime()",100);
}
window.onload=showtime;
//-->
</script>