简单数字时钟
2020-04-03 本文已影响0人
貳條
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>exam time</title>
<style>
.time { font-size: 300pt; line-height: 200%; color:b;}
</style>
<script type="text/javascript">
var getObj = function(id){
if(!id){
return false;
}
return document.getElementById(id);
};
<!-- Hiding
var ctimer;
function settimes(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
if (hours<10)
hours="0"+hours;
if(mins<10)
mins="0"+mins;
if (secs<10)
secs="0"+secs;
getObj('tim1').innerHTML=hours+":"+mins+":"+secs
ctimer=setTimeout('settimes()',960);
}
// Done hiding -->
</script>
<title>js data clock</title>
</head>
<body onload="settimes()">
<!---->
<!--<div class=time id=tim1 style="height: 500px; left: 300px; position: absolute; top: 100px; width: 500px"></div>-->
<div class=time id=tim1 style="text-align:center"></div>
</body>
</html>