Experts Round Table Cd LOGO
HOME
FORUM
ARTICLES
TUTORIALS
SCRIPTS
LINKS
NEWS
MENTORS
TOOLS
REGISTER

a tutorial by COBOLdinosaur

The use of popup blockers creates a problem for developers who need to put up supporting information on a page. So they need an alternative. A styled layer has been the popular workaround, but it is a lot of work. Not just writing the code'; it means bring the code for the popup into the main pages; a non-starter if it has to be dynamic. An alternative method is to use inline frames. That way the pages are already set up or generated for the popups and the original structure of the page does not need much additional work. They just get loaded into the iframes, and the script gets modified.

The trick is getting them to be dynamic and that what this code does:

Try it: popup1 popup2 popup3

  1. The layers to hold the popups are declared like:


    The popup class can apply any styling but must include position:absolute
    Total control of the look size and position are all controlled by CSS and what controls are available are simply controlled from the HTML generated in script.

  2. The script contains two functions. One to format and launch the Iframe and one to close it:


  3. Now a link (as I have used) or any event can fire the popup by calling:
    putIF('div1','110px','10px','200px','200px','panel1.html')

    The arguments for the function are:

    • hldr the div layer to hold, position and size the iframe
    • x the left position of the popup including a valid unit for positioning
    • y the top position of the popup including a valid unit for positioning
    • w the width of the popup including a valid unit for dimensions
    • h the height of the popup including a valid unit for dimensions
    • url The name of the page or page generation script that will populate the popup

There you have it. A simple replacement. Most of the code structure, dimension values, layouts, and source pages already exist. It is just a matter of a little code to do the transition to a more user friendly, accessible, and spider friendly format; and you don't have to give up the required functionality. Of course if you are one of those jerks who keeps sticking popups with ads in my face, I will have to deal with that in another article that will deal with how to defeat your efforts without impairing the legitimate use of popups. (Hint: Ever hear of a Firefox extension called Adblock? and a blacklist of marketing morons?).

post to Dzone Digg this! Add to del.icio.us Googleize this Add to reddit Save to myYahoo Add to furl Add to Netvouz! Spurl this! Add to Linkroll! Save to Simpy Give if thumbs up on StumbleUpon Save to Blinklist Add to Tektag Save to Bibsonomy Submit to Tweako
Search ERT on the Tools Page
Did you know? You can discuss this article with the mentor who wrote it and others interested in the topic? You are invited to join the discussion with Go to the forum

Got a technical article or tutorial you want to publish on the Internet? Join Go to the forum in the Round Table Forum and let the Mentors know what you have. If it meets ERT standards, is factual and can help ERT visitors, then ERT Mentors and Editors can help you (without charge) polish your offering so it can be published and promoted by ERT. An article published on ERT may be read by as many as 10,000 visitors a week; promoting you, your site, and your ideas. Please note ERT does not publish re-prints; promotional handouts, or pieces consisting mainly of links. So original technical content only please. If you prefer you can email the Editor