Web Analytics Made Easy -
StatCounter Resetting dropdown-menu when clicked ? - CodingForum

Announcement

Collapse
No announcement yet.

Resetting dropdown-menu when clicked ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Resetting dropdown-menu when clicked ?

    I got a website with a left frame (menu) and a right frame (main area for pages), and after people have selected a page with a drop-down menu, I want it to reset to the first selection , after people have clicked, so people know which drop-down menu does what by looking at its title (the first selection is actually the title of the drop-down menu)

    I have tried playing with Onchange and selectedIndex, but sofar unsuccesfull.

    Any help much appreciated!

  • #2
    Code:
    <select onchange="changeNReset(this)">
    ...
    </select>
    Code:
    function changeNReset(target) {
      //...have fun...do something
      for ( i = 0; i < target.length; i++) {
        target[i].selected = false;
      }
      target[0].selected = true;
    }
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow

    Comment


    • #3
      I want to thank you heaps ! It works like a charm. The .selected eluded me in all the references I consulted.

      Comment

      Working...
      X