设计之家 > 教程 > 網頁教程 > 其他教程 >

"最后更新日期"代碼

作者:未知 來源:ARTDESIGN 時間:2005-04-23
"最后更新日期"
<script language="ja;vascript">
<!--hide script from old browsersdocument.write("本頁最后更新日期: " + document.lastModified + "")// end hiding -->
</script>
拷貝到你的html文件的<body>和</body>之間

走動的數字時鐘
將下面的代碼加入html文件的<head></head>之間
<script>
function tick() {
var hours, minutes, seconds, xfile;
var intHours, intMinutes, intSeconds;
var today;
today = new Date();
intHours = today.getHours();
intMinutes = today.getMinutes();
intSeconds = today.getSeconds();
if (intHours == 0) {
hours = "12:";
xfile = "午夜";
} else if (intHours < 12) {
hours = intHours+":";
xfile = "上午";
} else if (intHours == 12) {
hours = "12:";
xfile = "正午";
} else {
intHours = intHours - 12
hours = intHours + ":";
xfile = "下午";
}
if (intMinutes < 10) {
minutes = "0"+intMinutes+":";
} else {
minutes = intMinutes+":";
}
if (intSeconds < 10) {
seconds = "0"+intSeconds+" ";
} else {
seconds = intSeconds+" ";
}
timeString = xfile+hours+minutes+seconds;
Clock.innerHTML = timeString;
window.setTimeout("tick();", 100);
}
window.onload = tick;
</script>

將下面的代碼加入html文件任意需要的地方

<div id="Clock" align="center" style="font-size: 20; color:#000000"></div>

相關文章:

推薦設計

最新文章