26、时钟加在背景上

26、时钟加在背景上

脚本说明:

第一步:把如下代码加入<head>区域中:

<script language=javaScript>

<!--//

 

function clockon() {

thistime= new Date()

var hours=thistime.getHours()

var minutes=thistime.getMinutes()

var seconds=thistime.getSeconds()

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.innerHTML=thistime

}

 

if(document.layers) {

document.bgclockshade.document.write('<div id="bgclockshade" style="position:absolute;visibility:visible;font-family:Verdana;color:FFAAAAA;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>

 

 

 

第二步:<body>中加入如下代码:

<div id="bgclockshade" style="position:absolute;visibility:visible;font-family:Arial;color:FF8888;font-size:120px;top:102px;left:152px"></div>

 

<div id="bgclocknoshade" style="position:absolute;visibility:visible;font-family:Arial;color:DDDDDD;font-size:120px;top:100px;left:150px"></div>

 

<div id="mainbody" style="position:absolute; visibility:visible">

</div>

 

第三步:把<body>中内容改为:

<body bgcolor="#fef4d9" onLoad="clockon()">

 

Write a comment

Comments: 0