时间: 2021-07-31 作者:daque
</head> <body> <div id="div1" style="visibility:visible; position:absolute; left:10; top:10; z-index:1;"> <table bgcolor="#ffffcc" border="1"cellpadding="0" cellspacing="0"> <tr> <td>i can moving...</td> </tr> </table> </div>
<br><br> <input type="button" value="发端挪动" onclick="startmove()"> <input type="button" value="遏止挪动" onclick="stopmove()">
</body> </html>
这边重要运用了一个叫settimeout(function, interval)因变量,这个因变量的参数方法为: 第一个参数“function”为超时后挪用的因变量名,第二个参数“interval”为超时价,以微秒为单元。
提防一点是即使要遏止这个计时器,必需生存挪用这个settimeout()因变量后的归来值,经过cleartimeout(id)因变量来废除计时器。