Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Multiple Popup Windows in Same Page

    I would be eternally grateful to the kind soul who can steer me right on this problem I am having. I have been researching it online for about half the day and can't seem to make it work.

    I am designing a student resources webpage for my school. Each lesson has three parts: 1) A Video 2) A Study Sheet 3) A Quiz

    I want the lessons to open in a Javascript Popup window. I have gotten them to open in a popup window but the problem is that each exercise simply replaces the previous in the window instead of opening a new window. What do I need to do to the code below so that each resource opens a seperate javascript window with a slightly different position on the page so as not to overlap completely.

    This is the code that I have in the <head>

    <script type="text/javascript">
    function showPopup(url) {
    newwindow=window.open(url,'name','height=600,width=700,top=200,left=300,resizable,scrollbars=yes');
    if (window.focus) {newwindow.focus()}
    }
    </script>


    This is the code in the <body>

    <a href="Adjectives/AdjectivesExplanation/AdjectivesExplanation.html" onClick='showPopup(this.href); return(false);'>Adjective Video</a>

    <a href="Adjectives/ComparativePowerPointVid/ComparativePowerPointVid.html" onClick='showPopup(this.href); return(false);'>Comparative Adjectives</a>

    Thank you.

    Rudi

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    That is because you are using the same name for your popups. Try the following

    Code:
    <script type="text/javascript">
    function showPopup(url,option) {
    var name='newwindow'+option;
    
    newwindow=window.open(url,name,'height=600,width=700,top=200,left=300,resizable,scrollbars=yes');
    if (window.focus) {newwindow.focus()}
    }
    </script>
    Code:
    <a href="Adjectives/AdjectivesExplanation/AdjectivesExplanation.html" onClick='showPopup(this.href,1); return(false);'>Adjective Video</a>
    
    <a href="Adjectives/ComparativePowerPointVid/ComparativePowerPointVid.html" onClick='showPopup(this.href,2); return(false);'>Comparative Adjectives</a>
    Last edited by abduraooft; 02-27-2009 at 03:13 PM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks a million!


  •  

    Posting Permissions

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