View Full Version : javascript not working in Opera

08-22-2007, 10:01 AM

I have this piece of code in my form and it works fine in IE, Firefox and Safari, but not in Opera.
<input type=text name=person size=41 maxlength=32 value="">

<select onChange="if(this.value){form.person.value=this.value;}">
<option value="">Choose</option>
<option value="person1">person1</option>
<option value="person2">person2</option>

where "form" is the name of the form. Once a person makes a choice in the select field, the chosen value should be displayed in the "person" field. However in Opera, nothing happens after making a choice. Can anyone please advise how this can be funcional also in Opera?

Thank you in advance.

08-22-2007, 10:57 AM
You might have used the complete correct reference (document['form'])

<select onchange="document['form']['person'].value=this.value">

or the self reference (this.form)

<select onchange="this.form['person'].value=this.value">

But you may also use the direct cross reference possibility (it works only for the form's controls):

<select onchange="person.value=this.value">