代码如下:
//指定时间之后跳转 <script language="javascript"> function go( ) {//定义函数 window.location="main.html";//页面跳转 } window.setTimeout("go()",1000);//1秒后执行函数go </script> //指定时间之后自动关闭 <script type="text/javascript"> function closeMyWindow() { window.setTimeout("window.close()", 1000); } </script> <body> <p> <!--Chrome IE有效,FireFox无效--> <input type="button" value="return closeMyWindow()" onclick="return closeMyWindow()" /> <br /> <!--Chrome IE有效,FireFox无效--> <input type="button" value="onclick='closeMyWindow()'" onclick="closeMyWindow()" /> <br /> <!--IE有效,FireFox无效--> <a href="#" onclick="closeMyWindow()">'closeMyWindow()'</a> <br/> <!--Chrome IE有效,FireFox无效--> <a href="#" onclick="window.close()">'window.close()'</a> <br/> </p> </body>
相关文章: