from and back button

Discussion in 'HTML' started by mantas.vitkunas@gmail.com, Apr 5, 2007.

  1. Guest

    I've written a web page in which a <select> element uses the
    "onchange" attribute to advance to another page instead of requiring
    the user to pick an option from the select menu and then click a
    "submit" button.

    One problem with this, however, is that if the user clicks their back
    button after using the <select> menu, the previously selected value
    remains in place.
     
    , Apr 5, 2007
    #1
    1. Advertising

  2. BootNic Guest

    > <> wrote:
    > news:
    > I've written a web page in which a <select> element uses the
    > "onchange" attribute to advance to another page instead of requiring
    > the user to pick an option from the select menu and then click a
    > "submit" button.
    >
    > One problem with this, however, is that if the user clicks their back
    > button after using the <select> menu, the previously selected value
    > remains in place.


    Set the selectedIndex before you jump.

    Object.selectedIndex=0;

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    </head>
    <body>
    <select onchange="var a=this.options[this.selectedIndex].value;
    this.selectedIndex=0;
    window.location=a;">
    <option selected="selected">Select</option>
    <option value="http://www.google.com">Google</option>
    <option value="http://www.yahoo.com">Yahoo</option>
    </select>
    </body>
    </html>
    --
    BootNic Thursday, April 05, 2007 12:10 AM

    All things come to him who waits - provided he knows what he is
    waiting for.
    *Woodrow T. Wilson*
     
    BootNic, Apr 5, 2007
    #2
    1. Advertising

  3. Scripsit :

    > I've written a web page in which a <select> element uses the
    > "onchange" attribute to advance to another page instead of requiring
    > the user to pick an option from the select menu and then click a
    > "submit" button.


    And then you leave users with JavaScript disabled exactly where? Note that
    this includes indexing robots.

    > One problem with this, however, is that if the user clicks their back
    > button after using the <select> menu, the previously selected value
    > remains in place.


    The real problem is that you are using an expensive poorly working plastic
    imitation of a list of links. Use links, Luke. For a list of reasons, check
    http://www.cs.tut.fi/~jkorpela/forms/navmenu.html#ben

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Apr 5, 2007
    #3
  4. On Apr 4, 8:26 pm, ""
    <> wrote:
    > I've written a web page in which a <select> element uses the
    > "onchange" attribute to advance to another page instead of requiring
    > the user to pick an option from the select menu and then click a
    > "submit" button.
    > One problem with this, however, is that if the user clicks their back
    > button after using the <select> menu, the previously selected value
    > remains in place.


    # Set the selection back to default before you change the location of
    page.

    or

    # Set the selection to default on page load.
     
    scripts.contact, Apr 9, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sylvia sil
    Replies:
    1
    Views:
    650
    Curt_C [MVP]
    Dec 29, 2004
  2. Chicagoboy27

    image button as a back button

    Chicagoboy27, Oct 26, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    2,042
    Chicagoboy27
    Oct 30, 2006
  3. phancey
    Replies:
    3
    Views:
    2,604
  4. Author
    Replies:
    6
    Views:
    3,255
    George
    Jan 22, 2009
  5. Useful Info

    Firefox back button takes me back 2 pages.

    Useful Info, Jun 3, 2007, in forum: Javascript
    Replies:
    0
    Views:
    362
    Useful Info
    Jun 3, 2007
Loading...

Share This Page