`
pouyang
  • 浏览: 313954 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

JS 定时任务setTimeout与setInterval

 
阅读更多
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
setTimeout
<script>
// Object,Boolean,function,Array,String
// Number,Date,RegExp,Error

function a() {
		var a = new Date(2007,2,1);
		//alert(a);
		//alert(Date.parese("2007年3月1日"));
		var time = new Date();
		var seconds = time.getSeconds();
		mainbody.innerHTML = seconds;
		//定时 window.setTimeout("a()",1000);
		var timer = setTimeout("a()",1000);
		//setInterval 
}
 
</script>
<body onLoad="a()">
<div id = "mainbody" ></div>
</body>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics