Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    javascript not working in Opera

    Hello,

    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>
    </select>

    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.
    Martin

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    You might have used the complete correct reference (document['form'])
    Code:
    <select onchange="document['form']['person'].value=this.value">
    or the self reference (this.form)
    Code:
    <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):
    Code:
    <select onchange="person.value=this.value">
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •