homepage Welcome to WebmasterWorld Guest from 54.161.191.254
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Browsers / Opera Browser Usage and Support
Forum Library, Charter, Moderator: open

Opera Browser Usage and Support Forum

    
Select Control onChange Event
Difference betw. IE/Opera and Mozilla/Netscape?
Reflection




msg:1585592
 10:03 pm on Jun 5, 2003 (gmt 0)

Ok I am encountering a problem with my onChange event for a select control. In Mozilla and Netscape, 'this.value' gets sent properly to my function, but in IE and Opera 'this.value' is nothing.

Simplified version of code:

<select name="weeks" onChange="alert(this.value);">
<option> </option>
<option>4</option>
<option>8</option>
<option>12</option>
<option>16</option>
<option>20</option>
<option>24</option>
</select>

Any idea why this problem is occuring and what I can do to remedy it?

Thanks.

 

HocusPocus




msg:1585593
 10:46 pm on Jun 5, 2003 (gmt 0)

On the face of it, it looks like it should work.

If you change the onChange event handler to
onChange="alert(this.options[this.selectedIndex].value);"

and explictly state the options value,
<option value="4">4</option>

Then it works.

Reflection




msg:1585594
 10:56 pm on Jun 5, 2003 (gmt 0)

Thanks that works.

Curious as to why my original method would work properly in Mozilla but not IE.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Browsers / Opera Browser Usage and Support
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved