SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Non-Member
    Join Date
    Jan 2000
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How do I get a drop-down menu to open the links in it in a new window?

    I have tried adding TARGET="_BLANK at various places on the form, but to no avail, the links still open in the current window.

    I know it's possible if I have a 'GO'-type button that is clicked after an option is selected, but I prefer a drop-down menu that works automatically without having to press the 'GO' button.

    <FORM NAME="nav"><DIV>
    <SELECT NAME="SelectURL" onChange=
    "document.location.href=
    document.nav.SelectURL.options[document.nav.SelectURL.selectedIndex].value" TARGET="_BLANK" >
    <OPTION VALUE="http://www.freefind.cjb.net"
    SELECTED>Please select an option:
    <OPTION VALUE="http://CDUK.Best.CD">
    CD UK - Music Shopping
    <OPTION VALUE="http://TopSitesUK.cjb.net">
    TopSites UK - Britain's Best Websites
    </SELECT><DIV>
    </FORM>


    Can anybody help me please?

    Thanks...

  2. #2
    Irritability Defined
    Join Date
    Jul 2000
    Location
    80,000 feet below the surface
    Posts
    1,442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried it in the actual <FORM> tag?
    My 2 Cents (or is that 2.2 Cents including GST?)

  3. #3
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey nazam,

    Instead of using this:

    Code:
    <SELECT NAME="SelectURL" onChange="document.location.href=document.nav.SelectURL.options[document.nav.SelectURL.selectedIndex].value" TARGET="_BLANK" >
    use this:

    Code:
    <select name="SelectURL" onchange="window.open(document.nav.SelectURL.options[document.nav.SelectURL.selectedIndex].value)">
    aDog

  4. #4
    Non-Member
    Join Date
    Jan 2000
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you

    You can now see the script working at http://www.UKHotMovies.com/welcome.shtml - thanks to you!

  5. #5
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are welcome.

    Just curious, but why is the Karma on that post negative?

    aDog

  6. #6
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Beats me - you rock the JavaScript world here, and I gave you Karma for your post - it was dead on, and was 100% what he was looking for.


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
  •