您的位置:首页 > 其它

javcript timer控制

2015-10-15 10:55 302 查看
<script type="text/javascript">
var num = 0;
//间隔一秒循环执行
var id = setInterval(function ()
{
num = num + 1;
document.getElementById("ss").value = num;
}, 1000);

//间隔一秒执行一次
var ids = setTimeout(function () {
num = num + 1;
document.getElementById("ss").value = num;
}, 1000);
//停止方法
function stopModth() {
clearInterval(id);
clearTimeout(ids);
}
</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: