定义和用法
clearTimeout() 方法可取消由 setTimeout() 方法设置的 timeout。
语法
clearTimeout(id_of_settimeout)
参数
描述
id_of_settimeout |
由 setTimeout() 返回的 ID 值。该值标识要取消的延迟执行代码块。 |
实例
下面的例子每秒调用一次 timedCount() 函数。您也可以使用一个按钮来终止这个定时消息:
<html>
<head>
<script type="text/javascript">
var c=0
var t
function timedCount()
{
document.getElementById('txt').value=c
c=c+1
t=setTimeout("timedCount()",1000)
}
function stopCount()
{
clearTimeout(t)
}
</script>
</head>
<body>
<form>
<input type="button" value="Start count!" onClick="timedCount()">
<input type="text" id="txt">
<input type="button" value="Stop count!" onClick="stopCount()">
</form>
</body>
</html>
分享到:
相关推荐
* `clearTimeout()`:清除 setTimeout() 返回的 ID 值。 * `clearInterval()`:清除 setInterval() 返回的 ID 值。 本文档涵盖了 JavaScript 操作 BOM 对象的多种知识点,包括 window 对象、history 对象、location...
这里主要用到两个HTMLDOMWindow对象中函数,settimeout(),clearTimeout() 我这里两个单击事件触发的时间间隔设置在等于300毫秒,这里需要根据实际情况而定。 源码如下: <!DOCTYPE html> <html>
2.掌握Dom操作中的添加/删除子节点方法。 3.使用setTimeout设置定时器。 4.使用clearTimeout清除定时器以及事件代理的运用。 效果图: 1)实现删除分享内容功能 利用事件代理实现点击关闭按钮删除分享内容。 删除...
|--3.concat()方法--用于连接两个或多个数组,该方法不会改变现有的数组 |--4.slice()方法--截取元素。根据给定的范围可从已有的数组中返回选定的元素 14.Function:js中一切都是对象,连方法都是1个对象!! ...
DOM Compatibility with Internet Explorer 4 Section 17.4. DOM Compatibility with Netscape 4 Section 17.5. Convenience Methods: The Traversal and Range APIs Chapter 18. Cascading Style Sheets ...
clearTimeout(timeOutId); //设定定时器,延迟500ms发送 timeOutId=setTimeout(function(){ $.post("autoCompleteServlet",{word:wordText},function(data){ //把数据转换成jquery...
obj.parentNode(dom) 交换表的行 TableID.moveRow(2,1) 替换CSS document.all.csss.href = "a.css"; 并排显示 display:inline 隐藏焦点 hidefocus=true 根据宽度换行 style="word-break:break-all" ...
//将dom对象data转换为jquery数据 var jqueryObj = $(data); //找到所有word节点 var wordNodes = jqueryObj.find("word"); autoNode.html(""); //遍历word,将...
4.一个浏览器窗口中的DOM顺序是:window->(navigator,screen,history,location,document) 5.得到表单中元素的名称和值:document.getElementById("表单中元素的ID号").name(或value) 6.一个小写转大写的JS: document....
{14.4}dom4j}{207}{section.14.4} {14.5}XPath}{210}{section.14.5} {14.6}apache.commons}{211}{section.14.6} {15}sqlite3}{213}{chapter.15} {16}Web基础}{215}{chapter.16} {16.1}...