天天看点

SetTimeOut方法用法示例

2006年01月07日 21:05:00

(一).示例图片效果

SetTimeOut方法用法示例

(二).代码

>html<

>head<

>title /title<

>script laguage="javascript"<

>!--

function showtime()

{

mytime=new Date();

mytime=mytime.getHours()+":"+mytime.getMinutes()+":"+mytime.getSeconds();

document.myform.mytext.value=mytime;

window.clearTimeout(mytimeout);

var mytimeout=window.setTimeout("showtime()",1000)

}

//--<

>/script<

>/head<

>body bgcolor="#FFFFFF" text="#000000"<

>form name="myform"<

>table background-color:lightgreen;color:blue"<>/td<

>td<>input type=button value="设置时间" οnclick=window.setTimeout("showtime()",1000) style="background-color:lightblue;"<>/td<

>/tr<

>/table<

>/form<

>/body<

>/html<

Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=573114

继续阅读