SitePoint Sponsor

User Tag List

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

    Window.ONCLICK or Window.ONLOAD ?

    Could you please help me out, please see the code below. At present, the window attributes are loaded from the popup.js file.

    _________________________________________________

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

    </script>

    <script>

    window.onload=function(){
    new popUp(200, 100, 600, 550, "Brad", "CONTENT" "0066ff", "white", "#FFFFFF", "0066ff", "666666", true, true, true, true, false);
    }
    </script>

    <a href="javascript:showbox('Brad')">LINK TO POPUP</a>
    _________________________________________________

    - The :showbox relates to the attributes in the .js file.

    At present the window loads fine when the page is loaded, but i ONLY want it to be displayed when the link is clicked.

    I have tryed changing window.onload to onclick but it does not seam to work. I know its simple but cannot figure it out.

    Thanks

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <script type="text/javascript" src="popup.js"></script>
    <script type="text/javascript">
    function showPopup()
    {
        showbox("Brad");
        new popUp(200, 100, 600, 550, "Brad", "CONTENT" "0066ff", "white", "#FFFFFF", "0066ff", "666666", true, true, true, true, false);
    }
    </script>
    HTML Code:
    <a href="#" onclick="showPopup(); return false;">LINK TO POPUP</a>
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Zealot
    Join Date
    Aug 2003
    Location
    Nr Leeds
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Mate... Thank-You for the response, but it does not seam to work...
    Has anyone else got any suggestions ?

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What doesn't work? What does showbox() and popUp() do? It could be something in either of those two functions that causes the problems ... whatever they are.
    Birnam wood is come to Dunsinane

  5. #5
    SitePoint Zealot
    Join Date
    Aug 2003
    Location
    Nr Leeds
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please find attached the popup.js file.

    It was a script i got from the internet. The version i posted works fine displaying a popup when the page loads, and making a link to re-open the popup if it is closed.

    What i want it to do is to ONLY open the popup when the link is clicked. I want to keep it displaying in the window made from the Javascript file as it looks and suites the site really well.

    Thanks
    Attached Files Attached Files

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


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
  •