Re: reset select-tag only
- From: "BootNic" <Bootnic@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 29 Sep 2005 16:31:30 GMT
> "google@xxxxxxxxxxxxxxx" <google@xxxxxxxxxxxxxxx> wrote:
> news:1128010747.558621.251500@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> Hi,
>
> is it possible to reset a SELECT-Tag to it's default value but not
> reset all other form fields?
> Here's an example:
>
> <select id="myselect" name="myselect">
> <option> value1 </option>
> <option> value2 </option>
> <option selected> value3 </option>
> <option> value4 </option>
> </select>
>
> What I need is a Javascript function which resets the myselect-field
> to it's inital value3. It may have been changed by the user to let's
> say value4.
> Setting the selectedIndex=0 will not work as it will select the first
> (value1) option instead of value3. Same thing with selectedIndex=-1
> which will select nothing.
<select id="myselect" name="myselect" onchange="this.selectedIndex='2'">
<option> value1 </option>
<option> value2 </option>
<option selected> value3 </option>
<option> value4 </option>
</select>
--
BootNic Thursday, September 29, 2005 12:31 PM
You can discover what your enemy fears most by observing the means he uses to frighten you.
*Eric Hoffer*
.
- Follow-Ups:
- Re: reset select-tag only
- From: google
- Re: reset select-tag only
- References:
- reset select-tag only
- From: google
- reset select-tag only
- Prev by Date: Re: collapse and uncollapse tables
- Next by Date: Re: firstNode problems
- Previous by thread: reset select-tag only
- Next by thread: Re: reset select-tag only
- Index(es):
Relevant Pages
|