Re: reset select-tag only



> "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*

.



Relevant Pages

  • Re: Data entered into form fields not saved
    ... Are you turning off the document protection and then turning it ... That will reset the formfields unless you use a macro to do ... "Jack" wrote in message ... > I have a Word document with several form fields. ...
    (microsoft.public.word.newusers)
  • Re: Word Form resets when opened
    ... On one computer running MS WORD 2003, ... On two other computers the form is not reset. ... wdAllowOnlyReading is not appropriate for a form using form fields from the ... Form fields in an unprotected form will reset when fields are updated. ...
    (microsoft.public.word.docmanagement)
  • reset select-tag only
    ... is it possible to reset a SELECT-Tag to it's default value but not ... reset all other form fields? ... it's inital value3. ...
    (comp.lang.javascript)
  • Re: reset select-tag only
    ... > is it possible to reset a SELECT-Tag to it's default value but not ... > reset all other form fields? ... You need to loop through all the options, ...
    (comp.lang.javascript)