internet explorer 6 - IE6: get value of a DOM select element -


So I'm having a cross browser javascript problem.

I have a and lieutenant; Some descendants with selected = true & lt; Options & gt; element containing & gt; Select the domain element.

In Firefox, I just select select_elt.value to get the value of the selected option, but it seems that in IE 6 (which I need to support) Do not have to work.

I chose select_elt.getElementsByTagName ('Options') selected & lt; Option & gt; To search for , which I could do, but option_elt.value still does not give me the value of that option.

So what is the proper way to get the value of an option or to select the element in IE6?

(Yes, I know that I should switch to jQuery or some other crossslaptor library, and I can do so, but now I'm curious about it How to make all in IE 6

This is the most Cross-browser is a compatible way (in my experience):

  var mySelect = document.getElementById ('mySelect'); Warning (mySelect.options [mySelect.selectedIndex] .Value );  

Comments

Popular posts from this blog

Is there an open source WebSockets (JavaScript) XMPP library? -

java - Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? -

mysql - Can mysql_pconnect be called multiple times in one php page? -