<!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>
<meta http-equiv="Content-Type" content="text/htmlcharset=utf-8" />
<title>无标题文档</title>
<script>
window.onload=function ()
{
var oDiv=document.getElementById('div1')
var value=1
setInterval(function(){
oDiv.innerHTML=value
value++
if(value>200){
value=1
}
},1000)
}
</script>
</head>
<body>
<div id="div1" ></div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta
http-equiv="Content-Type" content="text/htmlcharset=utf-8"
/>
<title>无标题文档</title>
<script
language="javascript">
var t = null
t =
setTimeout(time,1000)//开始执行
function time()
{
clearTimeout(t)//清除定时器
dt = new Date()
var
h=dt.getHours()
var m=dt.getMinutes()
var
s=dt.getSeconds()
document.getElementById("timeShow").innerHTML =
"现在的时间为:"+h+"时"+m+"分"+s+"秒"
t = setTimeout(time,1000)
//设定定时器,循环执行
}
</script>
</head>
<body>
<label
id="timeShow"></lable>
</body>
</html>
这种类型的代码网上是有资料的,自己多试试也是很好的。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)