当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > HTML DOM setTimeout() 方法

HTML DOM
DOM Input Checkbox
DOM Input File 对象
DOM Input Hidden对象
DOM Input Password 对象
DOM Input Radio 对象
DOM Input Reset 对象
DOM Input Submit 对象
DOM Input Text 对象
DOM Link 对象
DOM Location 对象
DOM Meta 对象
DOM Navigator 对象
DOM 对象
DOM Option 对象
DOM Screen 对象
DOM Select 对象
DOM Style 对象
DOM Table 对象
DOM TableData 对象
DOM TableHeader 对象

HTML DOM setTimeout() 方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 341 ::
收藏到网摘: n/a

Definition and Usage
定义与用法

The setTimeout() method is used to call a function or evaluate an expression after a specified number of milliseconds.
setTimeout()方法可用来在每个指定毫秒间隔后调用一个函数或是表达式

Syntax 语法

setTimeout(code,millisec,lang)

Parameter
参数
Description
描述
code Required. A pointer to a function or the code to be executed
必选。指定函数或是要执行的代码
millisec Required. The number of milliseconds to wait before executing the code
必选。执行代码所要等待的毫秒数
lang Optional. The scripting language: JScript | VBScript | JavaScript
可选。脚本语言类型


Example 举例

<html>
<head>
<script type="text/javascript">
function timedMsg()
{
var t=setTimeout("alert('5 seconds!')",5000)
}
</script>
</head>
<body>
<form>
<input type="button" value="Display timed alertbox!"
onClick="timedMsg()">
</form>
<p>Click on the button above. An alert box will be
displayed after 5 seconds.</p>
</body>
</html>


演练

Simple timing
简单的计时

Another simple timing
另一种计时

Timing event in an infinite loop
循环计时

Timing event in an infinite loop - with a Stop button
带停止按钮的循环计时

A clock created with a timing event
建立一个时钟的效果。

评论 (0) All

登陆 | 还没注册?