js關(guān)閉一個窗口并打開另一個窗口的方法
來源:懂視網(wǎng)
責(zé)編:小采
時間:2020-11-27 20:12:07
js關(guān)閉一個窗口并打開另一個窗口的方法
js關(guān)閉一個窗口并打開另一個窗口的方法:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript"> // 第一種方法,在body里的onunload事件中調(diào)用 // function openWin(){ // window.open('http
導(dǎo)讀js關(guān)閉一個窗口并打開另一個窗口的方法:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript"> // 第一種方法,在body里的onunload事件中調(diào)用 // function openWin(){ // window.open('http

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
// 第一種方法,在body里的onunload事件中調(diào)用
//
function openWin(){
//
window.open('https://www.baidu.com');
//
}
//
// 第二種方法,跟第一種差不多
function closewin(){
window.opener=null;
window.open('https://www.baidu.com');
window.close();
}
// 第三種,在多少秒之后關(guān)閉窗口并打開新的頁面
function clock(i) { // i為傳入幾秒
var timer = setInterval(function(){
if(i>0){
document.title= i + "秒后自動關(guān)閉本窗口!";
}else{
clearInterval(timer);
closewin();
}
i=i-1;
},1000);
}
//-->
</script>
</head>
<!--<body onunload="openWin()">-->
<body>
</body>
</html>
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
js關(guān)閉一個窗口并打開另一個窗口的方法
js關(guān)閉一個窗口并打開另一個窗口的方法:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript"> // 第一種方法,在body里的onunload事件中調(diào)用 // function openWin(){ // window.open('http