SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    Non-Member
    Join Date
    Mar 2005
    Location
    Bangkok
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    resetting select boxes

    Hi, does anyone know how to reset select boxes.

    For example, let's say you use a select box as a dropdown menu. And let's say it contains several options such as England, America, Australia. And let's say that clicking on any of these options will take you to another page.

    However, if you use your browser's back button to return to the menu you will notice that the select box still shows the option which you just selected.

    Problem is, any value that was originally assigned to this option has now been lost.

    So, how can I reset the menu in the event that it is revisited by someone using the browser's back button.

    Thanks for any help you can give.

  2. #2
    SitePoint Zealot Skibum1321's Avatar
    Join Date
    Jun 2003
    Location
    Malden, MA
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just call the following onload:

    Code:
    document.getElementById('select_id').selectedIndex = -1;
    Keith Rousseau


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
  •