星空网 > 软件开发 > Java

clearInterval() 方法

clearInterval()方法的定义和用法:
此方法能够取消setInterval()方法设置的定时器。
此方的参数必须是要取消的相应的setInerval()方法的返回值。
点击可参阅更多window对象的属性和方法。
语法结构:

clearInterval(id)

参数列表:

参数描述
id必需。此id是setInerval()的返回值,是此setInerval()方法的唯一标识。

浏览器支持:
(1).IE浏览器支持此属性。
(2).Firefox浏览器支持此属性。
(3).Opera浏览器支持此属性。
(4).chrome浏览器支持此属性。
(5).safria浏览器支持此方法。
代码实例:

<!DOCTYPE HTML><html><head><meta charset="utf-8"/><meta name="author" content="http://www.softwhy.com/" /><title>window对象的clearInterval()方法 -蚂蚁部落</title><style type="text/css">#num{ width:100px; height:100px; text-align:center; line-height:100px; background-color:green; margin:50px auto 0px auto; color:red;}#btdiv{ width:76px; height:76px; margin:0px auto;}</style><script type="text/javascript">var a=0;window.onload=function(){ var num=document.getElementById("num"); var bt=document.getElementById("bt"); function jisuan(){  num.innerHTML=a;  a=a+1; } var flag=setInterval(jisuan,1000); bt.onclick=function(){  clearInterval(flag); }}</script></head><body><div id="num"></div><div id="btdiv"><button id="bt">点击取消</button></div></body></html>

以上代码点击按钮可以取消数字自增效果。

原文地址是:clearInterval() 方法 一章节。

 




原标题:clearInterval() 方法

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

选择合适的银行,开设香港账户更轻松 :https://www.kjdsnews.com/a/1836821.html
个人离岸账户的开设及管理指南 :https://www.kjdsnews.com/a/1836822.html
海牙认证技巧揭秘:辨别真伪的秘诀 :https://www.kjdsnews.com/a/1836823.html
全面解读BVI公司律师公证所需费用 :https://www.kjdsnews.com/a/1836824.html
解密!三亚公司在香港银行开户流程详解 :https://www.kjdsnews.com/a/1836825.html
FTN账户税务指南:实现合规缴税,规避风险 :https://www.kjdsnews.com/a/1836826.html
宠物梳专利查询分析:https://www.kjdsnews.com/a/1842293.html
温州旧货市场有玻璃柜卖吗?:https://www.vstour.cn/a/411246.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流