Opening my menu selection in a new window

Discussion in 'JavaScript' started by cstallins, Sep 12, 2007.

  1. #1
    Using XHTML we can use target="_blank" to open a file in a new window (or page). I want to do something similar using JS, but this short script I found does not presently do that - it presents the new file in the same window. Can you help me modify the function or form below so that my drop-down selection opens the selected file in a new window?

    Here's my function that appears between my <head> and </head>:

    <script language="javascript" type="text/javascript">
    <!-- hide script from archaic browsers
    function jumpPage(newLoc) {
    newPage = newLoc.options[newLoc.selectedIndex].value
    if (newPage != "") {
    window.location.href = newPage
    }
    }
    // end hiding script -->
    </script>

    And here's my form that presents the small drop-down select box:

    <form action="gotoLocation.cgi" method="get">
    <select name="newLocation" onChange="jumpPage(this.form.newLocation)">
    <option value="" selected>2007 - Select a Newsletter
    <option value="newsletters/2007newsletters/200709.pdf">September 2007
    </select>
    <noscript>
    <input type="submit" value="Get it Now!">
    </noscript>
    </form>

    Thank you for any guidance you can offer.
    Curtis
     
    cstallins, Sep 12, 2007 IP
  2. phper

    phper Active Member

    Messages:
    247
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #2
    look up the window.open() function
     
    phper, Sep 13, 2007 IP