JQuery编写的定时器实现时钟
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>定时器制作时钟</title>
<script type="text/javascript" src="Jquery/jquery.js"></script>
<script type="text/javascript" src="Jquery/jquery.timers-1.2.js"></script>
<style>
input[type="text"]{
font-family: "仿宋";
font-size: 132px;
color: #00FFFF;
opacity: 0.5;
border: none;
}
</style>
</head>
<body>
<input type="text" id="txtdt" value=""/>
<script>
$(document).ready(function() {
$('body').everyTime('1s', function() {
var d = new Date();
$("#txtdt").val(d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds() );
});
})
</script>
</body></html>
运行后的结果展示: