W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<html> <head> <script> myWindow = null; function openWin(){ if( myWindow != null ){ myWindow.close(); } myWindow=window.open('','','width=200,height=100'); myWindow.document.write("<p>这个窗口可以地震</p>"); } function closeWin(){ if( myWindow != null ){ myWindow.close(); } } function startEQ() { richter=5 myWindow.moveBy(0,richter) myWindow.moveBy(0,-richter) myWindow.moveBy(richter,0) myWindow.moveBy(-richter,0) timer=setTimeout("startEQ()",10) } function stopEQ() { clearTimeout(timer) } </script> </head> <body> <form> <input type="button" onclick="openWin()" value="第一步:打开窗口"> <br /> <br /> <input type="button" onclick="startEQ()" value="接下来:开始地震"> <br /> <br /> <input type="button" onclick="stopEQ()" value="然后可以:停止地震"> <br /> <br /> <input type="button" onclick="closeWin()" value="最后一步:关闭窗口"> </form> </body> </html>