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't get combo box value in FF

Status
Not open for further replies.

Kendel

Programmer
Apr 24, 2002
1,512
US
Can someone please show me how to get a combo box value in FF?
With IE7, I can use this:

Code:
var comboVal = document.getElementById("combo1").value;

OR

var selIndex = document.getElementById("combo1").selectedIndex;
comboValue = document.getElementById("combo1").options[selIndex].value;

OR

var combo1 = document.getElementById("combo1");
var comboValue = combo1.options[combo1.selectedIndex].value;

None of these work with FF. Why???
 
My select does have an ID. I'm using FF 3.5
It's strange!
 
Thank you for your offer. After each line of JavaScript function, I pop up an alert box saying OK or not and it fails right after I try to get the value of the combo box.
 
... and the address is?

If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
OK, I found the problem. It has something to do with the way I use getElementById in portal environment.

The above code will work just fine for FF in Web Application. Thank you.
 
I'm a long time member of tek-tips. I know when to give a star.

For this thread, who should I give a star to and why?
 
I am sorry Kendel, I was reading two posts at the same time and I put my comment in the wrong one. And I have seen your name many times here, so I certainly know you are a long time member :)
 
That's OK. I guess I should give a star to BRPS then :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top