Forum Moderators: open
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
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 :)