自己做了个背景时钟
<html><head>
<title>背景时钟</title>
<script type="text/javascript">
<!--//
function clockon(){
thistime = new Date()
//获取小时
var hours = thistime.getHours();
//获取分钟
var minutes = thistime.getMinutes();
//获取秒
var seconds = thistime.getSeconds();
//为个位数的时间前面加0
if(eval(hours) < 10)
{
hours = "0" + hours;
}
if(eval(minutes) < 10)
{
minutes = "0" + minutes;
}
if(seconds < 10)
{
seconds = "0" + seconds;
}
thistime = hours + ":" + minutes + ":" +seconds;
if(document.all){
bgclocknoshade.innerHTML = thistime;
bgclockshade.innerTHML = thistime;
}
//document.layers Netscape 4.x专有属性
if(document.layers){
document.bgclockshade.document.write('<div id="bgclockshade" style="position:absolute; visibility:visible; font-family:Verdana; color:ffaaaa; font-size:120px; top:10px; left:152px">'+thistime+'</div>');
document.bgclocknoshade.document.write('<div id="bgclocknoshade" style="position:absolute; visibility:visible; font-family:Verdana; color:dddddd; font-size:120px; top:10px; left:150px">'+thistime+'</div>');
document.close();
}
var timer = setTimeout("clockon()",200);
}
//-->
</script>
</head>
<body onLoad="clockon()">
<div id="bgclockshade" style="position:absolute; visibility:visible; font-family:Verdana; color:ffaaaa; font-size:120px; top:10px; left:152px"></div>
<div id="bgclocknoshade" style="position:absolute; visibility:visible; font-family:Verdana; color:dddddd; font-size:120px; top:10px; left:150px"></div>
<div id="mainbody" style="position:absolute; visibility:visible;"></div>
</body>
</html>
时钟显示的位置需要通过修正top和left参数来确定。top表示层距离显示器顶部的像素值,left表示距离左侧的像素值。