SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: OnClick popup

  1. #1
    SitePoint Enthusiast Lazarus's Avatar
    Join Date
    Aug 1999
    Location
    Singapore
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, can someone tell me how do I make a popup window to appear when someone clicks on a banner ad?

    ------------------
    Lazarus (8946037)
    http://www.moviem.com

  2. #2
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Combine the pertinent banner code and the popUp window into a function, then change your banner link to something like:

    <a href='javascript:void()' onClick='popBanner(1)'><img src="banner imgsrc"></a>

    function popBanner(banNum)
    {
    window.open(.....) or alert(....)
    switch (banNum)
    {
    case 1:
    ....banner1 redirect code...
    break;
    case 2:
    ....banner2 redirect code...
    break;
    }
    }

    Vinny


    ------------------
    my site:GrassBlade: cut&paste javascript
    moderator at:The JavaScript Place Forums
    Javascript City

  3. #3
    SitePoint Enthusiast Lazarus's Avatar
    Join Date
    Aug 1999
    Location
    Singapore
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How am I suppose to place the function in? I'm a loser at Javascript. Do I need to add the lines of the function too? What are the (....) for?

  4. #4
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    The function goes between your head tags, like most javascript functions. The "(...)" is where the window.open parameters go (url,winName,width....)

    If the above still makes no sense:
    1) buy a javascript book for beginners (SAM's Javascript in 24 Hours is good)
    2) see the javascript primer at http://www.htmlgoodies.com (I think kevin yank has tutorials at his site, also)

    Vinny

    ------------------
    my site:GrassBlade: cut&paste javascript
    moderator at:The JavaScript Place Forums
    Javascript City


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •