精品源码
正文

网页标题栏显示时间

来源:精品源码 时间:2012/11/14

网页标题栏上显示时间
代码如下:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var clocktext;
var pagetitle = document.title;
function scroll() {
today = new Date();
sec = today.getSeconds();
hr = today.getHours();
min = today.getMinutes();
if (hr <= 9) hr = "0" + hr;
if (min <= 9) min = "0" + min;
if (sec <= 9) sec = "0" + sec;
var clocktext = " 现在时间是: " + hr + ":" + min + ":" + sec;
clocktimer = setTimeout("scroll()", 1000);
document.title = pagetitle + clocktext;
}
if (document.all) scroll();
//  End -->
</script>

本文链接: http://www.webym.net/zhuanti/thred-1316.html