Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can this work in Netscape And IE?? 1

Status
Not open for further replies.

natg504

MIS
Dec 5, 2005
13
US
I have this line of code that works fine in IE, but I cannot get it to work in Netscape. What would the Netscape equivalent be??


var div=document.getElementById(dataSet);

// get the input elements within the div
var inputMenus=div.getElementsByTagName('select')

for (i=0; i<inputMenus.length;i++) {
document.getElementById(txtFieldName).value = document.inputMenus.getAttribute('name');
}


Thanks,
 
I want to look at the value of the inputMenu, a dropdown menu with values 1-5. If it's not blank, I want to take the name of that menu & set it as the value of a hidden text field.

For example, if someone chooses "5" from inputMenu[1], which has a name "abc", i want to set the value of textField5 to "abc".

I've noticed that
inputMenus.getAttribute('value');
returns the correct value in IE, but not Netscape, so i think that is the main problem.

However,
inputMenus.getAttribute('name');
works in both.

thanks for your help.
 
just do:

Code:
inputMenus[i].value

or

Code:
inputMenus[i].options[inputMenus[i].selectedIndex].value

i suppose this is because there is no VALUE attribute of a select box.

*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
it looks like
inputMenus.options[inputMenus.selectedIndex].value
worked.

Thanks a lot!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top