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.
Welcome to Bucaro TecHelp!

Welcome to Bucaro TecHelp!
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

[About BTH]  [User Agreement]  [Privacy Policy]  [Site Map]  [Contact Form]  [Advertise on BTH]  [News Feed]

Google
Web
This Site

Code for a Less annoying Popup Window

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.

The JavaScript code included with this article creates a popup window that displays 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 popup window.

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.

To use this code, paste the indicated JavaScript code into the <head> 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()">

Also paste the indicated JavaScript code into the <head> section of your popup page. In your <body> tag, enter the code for the onFocus event handler as shown below.

<body onFocus="informParent()">

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.

Web Design Sections

RSS Feed RSS Feed

Easy Java Script Code
Easy Slide Show Code
Easy Slide Show Code with Mouseover Pause
Easy Slide Show Code With Linked Slides
Slide Show with Different Size Images
Easy Java Script Timer Code
Easy Java Script Windows
Easy Rollovers
Easy Picture Transition Effects
Easy Moving Popup Code
Easy Picture Zoom Code
Easy Picture Panning Code
Easy Java Script Animation
Easy JavaScript Picture Selector Code
Easy Animated Banners with Java Script
Easy Java Script Form Validation
Easy Drag n Drop Code
Easy Graph Generating Code
Easy Code to Sort a Table by Column
Easy Expanding Menu Code
Web Designer's Reference
Object-Oriented JavaScript
Easy Fading Text Banner Code
Easy Expanding Banner Code
Calendars for Your Website
Date Picker For Your Web Site
Calculators For Your Web Site
Loan Payment Calculator
Length Units Converter
Body Mass Index
Fahrenheit to Celsius Converter
Decimal to Hexidecimal Converter
Easy Code for Screen Tape Adding Machine
Code for Java Script Circle⁄Sphere Calculator
Code for Java Script Cube⁄Box Volume Calculator
Round a Float to 4 Digits to the Right of the Decimal Point
Disable IE8 Accelerators on Your Website
Prevent Automated Form Submissions With Java Script
Make Your Own Graphical Digital Clock
Let Your Web site Visitors Set Font Size
How to Disable the Browser Back Button
Add More Bang to Your Content With Keyword Popup Menus
Put a Music Off Switch on Your Webpage
Java Script Random Password Generator
Password Protection Using the JavaScript Cookie Method
Password Protection Using the Frames Method
Replace Drop-down with Drag-and-drop
Submit Forms Without CGI
Code for a Less annoying Popup Window
Java Script Comparison Operators
Using the Java Script Array Object
Using the Java Script Date Object
Java Script Message Boxes
Java Script Trim Function
Convert Mixed Number to Decimal
How to Shuffle the Deck With Java Script
Web Site Menus : Which Section Am I In?
How Far Did the User Scroll?
Where Did the User Click?
Four Ways to Use Java Script Event Handlers
Create Your Own Database Using Only Notepad : CDV


[Site User Agreement]  [Advertise on This site]  [Search This Site]  [Contact Form]
Copyright©2001-2009 Bucaro TecHelp P.O.Box 18952 Fountain Hills, AZ 85269