Forum Moderators: open
here is what I have
<select name="COLOR[1]" onchange="available(COLOR[1]) ">
this is the part of the function that breaks down..
function available(newLoc) {
newcolor = newLoc.selectedIndex
the function then goes on to update a div/layer based on the selection. It works great if I just name the form COLOR but that messes a major php script. I am stuck!
Can this be done ?
Any one have any Ideas ?
Thanks
David
function available(newLoc)
{
alert(document.frm[newLoc].selectedIndex)
//or whatever i.e. newcolor = etc.. etc..
} <form name="frm">
<select name="COLOR[1]" onChange="available('COLOR[1]')">
<OPTION value="0">0</OPTION>
<OPTION value="1">1</OPTION>
<OPTION value="2">2</OPTION>
</SELECT>
</form>
When passing the name of the element in the available function it needs to be in ''; otherwise it thinks you are passing a variable (which hasn't been defined).
Personally I would pass the whole object using onChange="available(this)" and pull it out in JS with newLoc.selectedIndex
I have only tried this in IE5 and it may not be what you were talking about in the firstplace - hope it was ;)