Make the pop-up window "considerate"

Source: Internet
Author: User
When surfing the Internet, some websites will pop up. It may be a kind greeting from the webmaster, or an important announcement or advertisement on the website. However, poor use will make people bored. How can I make the pop-up window take effect without affecting the browser's page browsing?

You need to close the pop-up window. It would be nice if it could be disabled by itself. To achieve this effect is actually very simple,

1. FirstProgramAdd to the


<Script language = "JavaScript">
<! --
VaR GT = Unescape ('3e ');
VaR popup = NULL;
VaR over = "launch pop-up Navigator ";
Popup = Window. Open ('', 'popupnav', 'width = 225, Height = 235, resizable = 1, scrollbars = auto ');
If (popup! = NULL ){
If (Popup. Opener = NULL ){
Popup. Opener = self;
}
Popup. Location. href = 'dogq.htm ';
}
// -->
</SCRIPT>

2. Create a New dogq.htm file (that is, the file used in the pop-up window). The file name must be consistent with the file name set in "Popup. Location. href = 'dogq.htm'" above.

3. Edit the new file dogq.htm(?dogq.htm must be in the same directory as the home page file ). Change <body bgcolor = "# ffffff" text = "#000000"> to <body bgcolor = "# fef4d9" onLoad = "closeit ()">, add the following content between <body> </body>:


<Script language = "JavaScript">
Function closeit (){
SetTimeout ("self. Close ()", 10000)
}
</SCRIPT>

Note: The 10000 in the last three rows indicates that the service is closed for too long (which can be modified as needed), and the 10000 value is 10 seconds. In this way, the pop-up window will be automatically closed in 10 seconds, and the viewer does not need to handle it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.