Re: Change the value of an Hidden field !!!!

Beware the "this-is-not-a-js-list" monsters; this really belonged
elsewhere.

> And the function is :
> 
> <script language="JavaScript1.2">
> function new_value();
> document.name_form.name_hidden.value = document.name_form.name_select.value;
>  }
> </script>
> 
> It work with MSIE but not with Netscape.
> Do you know what's wrong ?

Technically, there is no .value for select fields. You have to use

    document.name_form.name_select.options[
        document.name_form.name_select.selectedIndex].value;

and you can save a little script size by using temp variables for
document.name_form, etc.

If this seems a little odd, remember that selection boxes can be
defined to accept multiple selections so a simple .value isn't *that*
appropriate. However, since all other input objects have one it's not very
logical to leave it out altogether - which, I suppose, is why MSIE
provides one anyway.

Rup.

Received on Tuesday, 18 July 2000 06:20:40 UTC