Select Index value
Date: 03/10/06
(Javascript Community) Keywords: php
I know this is simply a syntax issue but I cant seem to find the right combination and I am wasting time....
Ok I have a form that is dynamically generated with PHP. (because it can grow rows)
each "row" of the form has a pulldown on the left.
I am naming and id-ing each pulldown with a sequential name.
What I need is to get the selected index of the pulldown on change. I am sending to the function the name of the pulldown and assigning the variable "id"
Doesn't work var box = document.segments.ElementsById[id];
Doesn't work var box = document.segments.elements[id];
Doesn't work var box = document.segments.id;
I keep getting the "No properties error" box
For the index I combine it with
var Content = box.options[box.selectedIndex].value;
Any ideas?
Source: http://community.livejournal.com/javascript/95989.html
|