Re: reset select-tag only
- From: "Matt Kruse" <newsgroups@xxxxxxxxxxxxx>
- Date: Thu, 29 Sep 2005 15:09:51 -0500
Matt Kruse wrote:
> for (var i=0;i<sel.options.length;i++) {
> if (sel.options[i].defaultSelected) {
> sel.options[i].selected = true;
> }
> else {
> sel.options[i].selected = false;
> }
> }
And actually, this would be more compact, but maybe less readable to someone
learning:
for (var i=0;i<sel.options.length;i++) {
sel.options[i].selected = sel.options[i].defaultSelected;
}
--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
.
- References:
- reset select-tag only
- From: google
- Re: reset select-tag only
- From: BootNic
- Re: reset select-tag only
- From: google
- Re: reset select-tag only
- From: Matt Kruse
- reset select-tag only
- Prev by Date: Re: passing variable - no answer?!
- Next by Date: HELP: Why won't this javascript work?
- Previous by thread: Re: reset select-tag only
- Next by thread: Re: reset select-tag only
- Index(es):