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中文网
Release: 2017-03-28 13:58:28
Original
2034 people have browsed it

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>
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template