be nice if it were that simple. options does'nt have a "name" property. it is the text property of the selected option you need. So;
Code:
function show() {
var sel_opt = document.getElementById('series').options.selectedIndex;
alert(document.getElementById('series').options[sel_opt].text + " : " + document.getElementById('series').value);
}
you've just got to love javascript for it's nice clean use of OOP syntax. NOT!
it could of course be written as
Code:
alert(document.getElementById('series').options[document.getElementById('series').options.selectedIndex].text + " : " + document.getElementById('series').value);
if you want to be truly convoluted.
btw the code box breaks "selectedIndex" it should be a single word.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
|