homepage Welcome to WebmasterWorld Guest from 54.226.93.128
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

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

Opera Browser Usage and Support Forum

    
addressing form elements in Opera 6
form elements in Opera
ericthefish




msg:1583854
 12:37 pm on Apr 7, 2003 (gmt 0)

Hi all,

I'm having some difficulty getting a simple form JS to work in Opera. My JS script works OK in IE4+, NS4+, and NS6+.

What is the correct JS syntax to reference form elements in Opera?

I'm using the following script for the other browsers:
"document.finder.product.selectedIndex=0;"
where the form name is "finder" and the element name is "product". This works OK except for Opera.

thanks in advance

eric

 

ericthefish




msg:1583855
 1:17 pm on Apr 7, 2003 (gmt 0)

Whoa...don't bother, it's just all started working.

Must be browser lockup or something!

Greg

DrDoc




msg:1583856
 7:07 pm on Apr 7, 2003 (gmt 0)

Welcome [webmasterworld.com] to Webmaster World!

Well, even though it's working... You should consider switching over to something like this:

if(document.getElementById) {
document.getElementById('product').selectedIndex=0;
}
else {
document.finder.product.selectedIndex=0;
}

This requires identical name and id attributes, and is forward and backward compatible :)

ericthefish




msg:1583857
 8:52 pm on Apr 7, 2003 (gmt 0)

Hi,

I had already tried 'getElementById' but I just got error messages, I think the browser must have crashed and confused matters.

I will use the method you suggest, it is preferable.

many thanks for the advice

Greg

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