#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Australia
    Posts
    111
    Rep Power
    14

    form/javascript problem


    I have this piece of code which works fine in IE, but not in NS (suprise suprise)
    What it is supposed to do is once you choose an option from the select box it should direct you to another page at the <a name> reference.

    Netscape takes you only to the top of the page.

    here is the code:

    <FORM action="index.html" method="get" name="form1">
    <SELECT name=menu1 language=javascript
    onChange="document.form1.action=this.options[this.selectedIndex].value;document.form1.submit();">
    <option value="h.html#_section1">Introduction</option>
    <option value="h.html#_section2">Personal Details</option>
    <option value="h.html#_section3">Change of Details</option>
    <option value="h.html#_section4">Induction Arrangements</option>
    </select>
    </form>

    Thank you
    wabirdman
    Real programmers code in binary
  2. #2
  3. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    Not a great idea, using a form submission for a re-direct like this. Try:

    <form>
    <select onchange="window.location=this[this.selectedIndex].value">

    Interesting:<SELECT ..... language=javascript >
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Australia
    Posts
    111
    Rep Power
    14
    Thanks - I did end up working it out

    I used this

    onChange="location.href=this.options[this.selectedIndex].value"

    cheers
    wabirdman
    Real programmers code in binary

IMN logo majestic logo threadwatch logo seochat tools logo