By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,760 Members | 1,091 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,760 IT Pros & Developers. It's quick & easy.

Force all select boxes on page to default?

P: n/a
I have a form with about 40 select boxes that are pre selected with
selections based on some passed data. What is a quick and easy way to
have a link on the page where when I click on it, it forces ALL of the
select boxes back to their default state selecting the first option in
the list which has a value of "" and the display value is "SELECT". I
basically want to reset them all.

??

THANKS

Feb 20 '07 #1
Share this Question
Share on Google+
2 Replies

P: n/a
Erich93063 wrote:
I have a form with about 40 select boxes that are pre selected with
selections based on some passed data. What is a quick and easy way to
have a link on the page where when I click on it, it forces ALL of the
select boxes back to their default state selecting the first option in
the list which has a value of "" and the display value is "SELECT". I
basically want to reset them all.
s=document.getElementsByTagName("select");ss=s.len gth;
while(ss--)s[ss].options[0].selected=true;
Mick
Feb 20 '07 #2

P: n/a
On Feb 20, 11:33 am, Michael White <m...@mickweb.comwrote:
Erich93063 wrote:
I have a form with about 40 select boxes that are pre selected with
selections based on some passed data. What is a quick and easy way to
have a link on the page where when I click on it, it forces ALL of the
select boxes back to their default state selecting the first option in
the list which has a value of "" and the display value is "SELECT". I
basically want to reset them all.

s=document.getElementsByTagName("select");ss=s.len gth;
while(ss--)s[ss].options[0].selected=true;
Mick
AWESOME! Worked perfectly. Thanks!

Feb 20 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.