語法展示:: http://home.graffiti.net/xdswjyht/
請用IE6.0或更新版本觀看語法特效展示
將以下程式碼複製,貼在<head>及</head>標籤之間。
<script language="JavaScript1.2">
<!--
timeID = null;
timeRunning = false;
var current = "";
function stop(){
if(timeRunning){
clearTimeout(timeID);
timeRunning = false;
}
}
function time(){
tick = new Date();
hours = tick.getHours();
minutes = tick.getMinutes();
seconds = tick.getSeconds();
current = "" + ((hours >12) ? hours -12 :hours);
current += ((minutes < 10) ? ":0" : ":") + minutes;
current += ((seconds < 10) ? ":0" : ":") + seconds;
current += (hours >= 12) ? " P.M." : " A.M.";
timeID = setTimeout("time()",1000);
timeRunning = true;
Dclock = current;
}
function runClock(){
stop();
time();
}
function showClock(){
timeIs="現在時間:" + Dclock
alert(timeIs);
}
function LoadFunctions(){
runClock(); timerONE=window.setTimeout;
}
-->
</script>
將以下程式碼複製,貼在插入<body >標籤裡面。
onLoad="LoadFunctions()"
將以下程式碼複製,貼在<body>及</body>標籤之間。
<center>
<A href="JavaScript:showClock()">想知道現在時間?按我看時間喔 ^_^</A>
</center>
留言列表