function init(){
var _1=document.getElementById("jure1");
var _2=1;
setInterval(function(){
_1.innerHTML=_2.toString();
++_2;
},5000);
var _3=document.getElementById("jure2");
var _4=0;
var f=function(){
_3.innerHTML=_4.toString();
++_4;
setTimeout(f,5000);
};
f();
};
function onResize(){
};<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./main.js"></script>
<script language="JavaScript">
</script>
<title>Widget Test</title>
</head>
<body onLoad="javascript:init();">
<h1>My nice sweet test Widget!</h1>
<div id="jure1" style="padding: 5px; font-weight: bold; background:#080485;color:#fff">0</div>
<div id="jure2" style="padding: 5px; font-weight: bold; background:#080485;color:#fff">0</div>
</body>
</html> 当我向前修改系统时间后(如:现在系统时间为15:28,我修改系统时间为13:28),setInterval 和setTimeout就不起作用了。这是为什么啊?
谁能说说setInterval(vCode, iMilliSeconds)具体的实现,针对时间间隔iMilliSeconds是如何获取的,如何知道经过某段时间就是iMilliseconds?
var _1=document.getElementById("jure1");
var _2=1;
setInterval(function(){
_1.innerHTML=_2.toString();
++_2;
},5000);
var _3=document.getElementById("jure2");
var _4=0;
var f=function(){
_3.innerHTML=_4.toString();
++_4;
setTimeout(f,5000);
};
f();
};
function onResize(){
};<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./main.js"></script>
<script language="JavaScript">
</script>
<title>Widget Test</title>
</head>
<body onLoad="javascript:init();">
<h1>My nice sweet test Widget!</h1>
<div id="jure1" style="padding: 5px; font-weight: bold; background:#080485;color:#fff">0</div>
<div id="jure2" style="padding: 5px; font-weight: bold; background:#080485;color:#fff">0</div>
</body>
</html> 当我向前修改系统时间后(如:现在系统时间为15:28,我修改系统时间为13:28),setInterval 和setTimeout就不起作用了。这是为什么啊?
谁能说说setInterval(vCode, iMilliSeconds)具体的实现,针对时间间隔iMilliSeconds是如何获取的,如何知道经过某段时间就是iMilliseconds?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货