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
    Aug 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open a Popup Window From A Dropdown Menu?

    Hey all,

    Can someone write me a script that opens a popup window, after you select an option from a dropdown menu and click a button? I'm a javascript n00b, so I have no idea how to write this one. I would truely appreciate it if you helped me out.

    Thanks,
    Shark Bite

  • #2
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Here ya go.

    Code:
    <html>
    <head>
    <script type="text/javascript">
    
    function winPop(url)
    {
    	window.open(url,'newWin');
    }
    </script>
    </head>
    <body>
    <form>
    <select id="drop1">
    <option selected>Select. . .</option>
    <option value="http://www.codingforums.com">CF</option>
    <option value="http://www.codingforums.com">CF</option>
    <option value="http://www.codingforums.com">CF</option>
    </select>
    <input type="button" onclick="winPop(document.getElementById('drop1').options[document.getElementById('drop1').selectedIndex].value);" value="GO">
    
    </body>
    </html>
    Basscyst
    Helping to build a bigger box. - Adam Matthews

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Modified it a bit.
    Code:
    function winPop(url)
    {
       if (url) {
          var w=window.open(url,'newWin');
          w.focus();
       }
       else alert("Please choose an item.");
    }
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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