中文(简体)
<!-- 要完成此效果把如下代码加入到<body>区域中--> <script LANGUAGE="JavaScript"> <!-- Begin day = new Date(); miVisit = day.getTime();函数时钟() { 今天 = 新日期(); hrNow = Today.getHours(); mnNow = Today.getMinutes(); scNow = Today.getSeconds(); miNow = Today.getTime(); if (hrNow == 0) { 小时 = 12; ap =“上午”; } else if(hrNow <= 11) { ap = "AM";小时 = hrNow; } else if(hrNow == 12) { ap = " PM";小时 = 12; } else if (hrNow >= 13) { 小时 = (hrNow - 12); ap =“下午”; } if (hrNow >= 13) { 小时 = hrNow - 12; } if (mnNow <= 9) { min = "0" + mnNow; } else (min = mnNow) if (scNow <= 9) { secs = "0" + scNow; } else { 秒 = scNow; } 时间 = 小时 + ":" + 分钟 + ":" + 秒 + ap; document.form.button.value = 时间; self.status = 时间; setTimeout('时钟()', 1000); } 函数 timeInfo() { milliSince = miNow; milliNow = miNow - miVisit; secsVisit = Math.round(milliNow / 1000); minsVisit = Math.round((milliNow / 1000) / 60); alert("欢迎光临downcodes.comnn本站域名:http://www.downcodes.comnn" + "你已经在本页面停留了" + minsVisit + "分" + secsVisit + “秒”+“”); } document.write("<center><form name="form">" + "<input type=button value="Click for info!"" + " name=button onClick="timeInfo() "></form></center>"); onError = null;钟(); // 结束 --> </脚本>