<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript"> // 第一种方法,在body里的onunload事件中调用 // function openWin(){ // window.open('https://www.baidu.com'); // } // // 第二种方法,跟第一种差不多 function closewin(){ window.opener=null; window.open('https://www.baidu.com'); window.close(); } // 第三种,在多少秒之后关闭窗口并打开新的页面 function clock(i) { // i为传入几秒 var timer = setInterval(function(){ if(i>0){ document.title= i + "秒后自动关闭本窗口!"; }else{ clearInterval(timer); closewin(); } i=i-1; },1000); } //--> </script> </head> <!--<body onunload="openWin()">--> <body> </body> </html>
以上就是js关闭一个窗口并打开另一个窗口的方法的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号