標記的名稱,無回傳值,大家進行網站開發時可以將改函數保存在JS文件中,以便重用 代碼如下:
<script><BR>function clockon(bgclock)<BR>{<BR> var now = new Date();<BR> var year = now.getYear();<BR> var year = now.getYear();< ();<BR> var date = now.getDate();<BR> var day = now.getDay();<BR> var hour = now.getHoypurs();<BR> var hour = now.getHogeturs();<BR> var hour = now.getHogeturs();<BR> ;<BR> var sec = now.getSeconds();<BR> var week;<BR> month = month 1;<BR> if(monmonth<10)monat=" 10)date="0" date;<BR> if(hour<10)hour="0" hour;<BR> if(minu<10)minu="0" minu;<BR> sec="0" sec;<BR> var arr_week = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");<BR> week = arr_week[day];<BR> var time = "";<BR> time = year "年" month "月" date "日" week "" hour ";" minu ";" sec>; document.all)<BR> {<BR> bgclock.innerHTML="[" time "]"<BR> }<BR> 🎜 ></script>
(2):在頁面的 的onload事件中呼叫以及在要顯示的地方放置div標記 程式碼: