Add a "onload" popup to wordpress using php

Discussion in 'OT Technology' started by Potato2, Jan 14, 2006.

  1. Potato2

    Potato2 Money and the power

    Joined:
    Jan 8, 2006
    Messages:
    2,633
    Likes Received:
    0
    Location:
    Maryland
    I can't figure this out for the life of me. Any tutorials would be appreciated.
     
  2. CyberBullets

    CyberBullets I reach to the sky, and call out your name. If I c

    Joined:
    Nov 13, 2001
    Messages:
    11,865
    Likes Received:
    0
    Location:
    BC, Canada/Stockholm, Sweden
    popups = teh suck
     
  3. hsmith

    hsmith OT Supporter

    Joined:
    Feb 24, 2002
    Messages:
    124,671
    Likes Received:
    769
    Location:
    Your mother.
    this is part of my "library" of JS code to do it. it adds your function to the window.onload event

    Code:
    
    
    
    function _Utils() {
    }
    
    /** 
     * Adds a new onload function to append onload events to the 
     * window onload.
     */
    _Utils.prototype.AddOnloadFunction = function(func) {
        if( window.onload ) {
            var oldfunc = window.onload;
            window.onload = function() { 
                oldfunc(); 
                func(); 
            };
        }
        else {
            window.onload = func;
        }
    }
     


    Example:
    Code:
    Utils.AddOnloadFunction( function() { alert('test'); } );
    

    but i agree, pops are annoying
     
  4. Aimless

    Aimless Resident drunkey

    Joined:
    Nov 5, 2001
    Messages:
    2,534
    Likes Received:
    0
    Location:
    Wisconsin
    I'd guess that at least 50 percent of web folk have some sort of popup blocker by now anyway.
     
  5. CyberBullets

    CyberBullets I reach to the sky, and call out your name. If I c

    Joined:
    Nov 13, 2001
    Messages:
    11,865
    Likes Received:
    0
    Location:
    BC, Canada/Stockholm, Sweden
    well both IE (with xp sp2) and FF block popups, i'd say maybe even more.
     
  6. Potato2

    Potato2 Money and the power

    Joined:
    Jan 8, 2006
    Messages:
    2,633
    Likes Received:
    0
    Location:
    Maryland
    Thanks guys, and I know popups are annoying.

    EDIT: where would I put that code within wordpress?
     

Share This Page