SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Aug 2003
    Location
    Nr Leeds
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript Popup Window Help !?

    Hello, please help i know it must be really simple but i cannot figure it out. Please have a look at the code below. The popup.js is just a script which defines the attributes of the window.

    I basically want it to display the popup as it is doing at the moment but only whent he hyper link is clicked. At present it is displaying it perfectly, but as the page loads.

    I know its the onload function which need changing, i have tryed OnClick but it dosent work.


    <script language="JavaScript" src="popup.js">

    </script>

    <script>

    window.onload=function(){
    new popUp(200, 100, 600, 550, "JEFF", "Content" true, true, true, true, false);
    }
    </script>

    <a href="javascript:showbox('JEFF')">Click here to read more about this service.</a>

  2. #2
    SitePoint Evangelist pip's Avatar
    Join Date
    Jun 2001
    Location
    Cape Town, South Africa
    Posts
    548
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hhmmmm... okay... here goes:

    You obviously have the following function somewhere in your javascript code:

    PHP Code:
    function popUp() {
      ...

    So, instead of doing it on load... remove the "window.onload" section completely, and on your link, put the following:

    Code:
    <a href="JavaScript:void(0)" onClick="showbox('JEFF');">Open Jeff!</a>
    This is how I would've gone about it, but there are other ways... you can also keep it on the HREF area, but I prefer doing it on click.

    Should work, and if it doesn't, let me know and tell me what happens.
    - Pip
    ---------------------------------------------------------------------------------
    Nothing takes the taste out of peanut butter quite like unrequited love.

  3. #3
    SitePoint Evangelist pip's Avatar
    Join Date
    Jun 2001
    Location
    Cape Town, South Africa
    Posts
    548
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, by the way... where's the "showbox" function?
    - Pip
    ---------------------------------------------------------------------------------
    Nothing takes the taste out of peanut butter quite like unrequited love.


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
  •