Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    May 2005
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do I clear a drop down box.

    Hi,
    I'm using several drop down boxes in my site and to clear my values in that i'm using a function.The drop down boxes are clearing well in IE and Opera but not in Firefox and mozilla.Tell me how to clear the values in my drop down boxes.
    The code I'm using in my function is
    Code:
    d.everyHour.value = "";
    .
    Thanks & Regards,
    Srikanth S

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    try
    document.forms['formname'].elements['boxname'].value

    but in facy you need to select the first option (I guess that the first option has the value ='' or no value, as the select's value is always the selected option's value.

    so that try rather:
    document.forms['formname'].elements['boxname'].options[0].selected=true;
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •