setTimeout()与clearTimeout()的使用

in 前端设计

<head>
<script type="text/javascript">
function startload()
{
mytimer=window.setTimeout("alert('时间很晚了,应该离开了!')",10000)
}
function stop()
{
window.clearTimeout(mytimer);
con=confirm("真的想结束浏览吗?");
if(con==ture)window.close();
}
</script>
</head>
<body onLoad="startload()">
<form>
<center>
<h3>请在10秒钟单击以下按钮以技术浏览:</h3>
<input type="button" value="请在10秒钟内单击此按钮" onClick="stop()">
</center>
</form>
</body>

0 Comments

Leave a Reply

Using Gravatars in the comments - get your own and be recognized!

XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>