来源:远方网络 | 2005-7-16 10:34:01 | (有2381人读过)
<script LANGUAGE="JavaScript"> <!-- Begin day = new Date(); miVisit = day.getTime(); function clock() { today = new Date(); hrNow = today.getHours(); mnNow = today.getMinutes(); scNow = today.getSeconds(); miNow = today.getTime(); if (hrNow == 0) { hour = 12; ap = "A"; } else if(hrNow <= 11) { ap = "A"; hour = hrNow; } else if(hrNow == 12) { ap = "P"; hour = 12; } else if (hrNow >= 13) { hour = (hrNow - 12); ap = "P"; } if (hrNow >= 13) { hour = hrNow - 12; } if (mnNow <= 9) { min = "0" + mnNow; } else (min = mnNow) if (scNow <= 9) { secs = "0" + scNow; } else { secs = scNow; } time = hour + ":" + min + ":" + secs + ap; document.form.button.value = time; setTimeout(''clock()'', 1000); } function timeInfo() { milliSince = miNow; milliNow = miNow - miVisit; secsVisit = Math.round(milliNow / 1000); minsVisit = (milliNow / 1000) / 60; alert("给你提个醒: " + "你已经在本页面上停留了大约" + minsVisit + "分或" + secsVisit + "秒"); } document.write("<left><form name=\"form\">" + "<input type=button value=\"Click for info!\"" + " name=button onClick=\"timeInfo()\"></form></left>"); onError = null; clock(); // End --> </script>
|