Code for a Less annoying Popup Window
By Stephen Bucaro
In previous articles I have stated my opinion that it very discourteous and stupid
for Webmasters use advertising popup windows on their Web sites. They get paid $0.01
or less to shove a popup window in your face. But in the end that causes them to
loose money because people avoid their Web site.
Since then many otherwise courteous and intelligent Webmasters have decided to use
popup windows because some moron is claiming they are "effective". Well if you must use
popup windows, maybe you will consider using this code for a less annoying popup window.
There are two things that make a popup window annoying. First, it covers the
information in the main window that you are trying to see. Second, you have click on
it to close it. One click will not break your arm, but the darn things are popping up
like flys on donky dung.
your adverting on top of the main window for four seconds, then it becomes a pop-under.
This is enough time for the user to read a short advertisement without getting too
annoyed. You can increase the time if you like, but keep it to a minimum.
After 60 seconds, the popup window closes itself. If the user has not clicked on the
popup window within 60 seconds, they are obviously not interested in it, so it closes
itself. The popup window also closes when the user closes the page that generated the
If the user clicks on the popup window before the 60 seconds lapses, the popup
window never closes. It stays open because obviously the user is interested in the
popup window contents.
You can test that function with this demonstration by reloading this page. (The code
for this demonstration closes the popup window after only eight seconds.) After four
seconds the example popup window will pop-under. If you click on its icon in your task
bar within eight seconds, it will return to the top and stay. But if you donít open the
popup window within eight seconds, it closes.
section of your web page. In your <body> tag, enter the file path of the page
that you want to display in the popup window. Also enter a width and height for the
popup window as shown below.
<body onLoad="OpenPopUp('popup.htm',600,300)" onUnLoad="ClosePopUp()">
popup page. In your <body> tag, enter the code for the onFocus event handler
as shown below.
The only problem with this method, is if the user does not finish reading the
popup window before it becomes a pop-under. But all the user has to do is click to
bring the window back to the top. It is important to use the <title> tag in
your popup window, so that the user can find the proper icon on the task bar if
they decide to open the window.
Another point of advice, you might want to put some text in the popup window to
inform the user that it will self close in four seconds. This will make the popup
window seem less annoying.
If you must use popup windows, consider using this code to create a less annoying
popup window. You can still present your ad and collect your penny, and your popup
window will automatically get out of your users face.
More Java Script Code:
• Easy Graph Generating Code
• Convert Mixed Number to Decimal
• Easy Slide Show Code With Linked Slides
• Using the Java Script Array Object
• Easy Code to Sort a Table by Column
• Easy Code for Date Count Down
• Calculators for Your Web Site : Loan Payment Calculator
• Easy Java Script Animation
• Code for Java Script Cylinder / Cone Volume Calculator