Home >Web Front-end >JS Tutorial >Open a new window and close the current page without popping up the closing prompt js code

Open a new window and close the current page without popping up the closing prompt js code

PHP中文网
PHP中文网Original
2017-03-28 13:58:282043browse

The code is as follows:

<script type="text/javascript"> 
function closeIt() { 
window.opener = &#39;&#39;; 
window.open(&#39;http://www.baidu.com&#39;); 
window.open(&#39;&#39;, &#39;_self&#39;); 
window.close(); 
} 
self.setInterval("newTime()", 1000) 
var t = 4; 
function newTime() { 
if (t > 0) { 
t = t - 1; 
document.getElementById("txtTime").value = t 
} 
else if (t <= 0) { 
closeIt(); 
} 
else { 
closeIt(); 
} 
} 
</script>

Related articles:

Click the return button to close the current page and window in WeChat, Alipay and Baidu Wallet

JS summary of several ways to close the current page (window)

JS code that automatically jumps or closes the current page after a specified time

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn