B
Bob Bedford
after Evertjan advice
, I'm trying to cut down a complex task in many
easier ones.
Here is the code I'm trying to get to work:
function CheckGroup(X){
code = X.value;
alert(code); //this is OK !!!!
obj = document.getElementById('option[]');
alert('object length '+obj.length);
for ( index = 0; index < obj.length; index++ )
{
testcode = obj[index].value;
if(code == testcode)
alert('found...');
}
}
then I print several input type like this:
//generated by PHP...$newvalue are new values at every checkbox (concat in
PHP is ".")
<input type="checkbox" name="option[]" value=".$newvalue."
onclick="CheckGroup(this)");>
Every checkbox is part of the option array (look at the name). In the
CheckGroup function, I try to retrieve all $newvalue from the option[]
array. So I try to retrieve every single item in the option[] array, but
unfortunately, it doesn't work.
alert(obj.length); show and undefined value.
How can I retrieve such items values ???
easier ones.
Here is the code I'm trying to get to work:
function CheckGroup(X){
code = X.value;
alert(code); //this is OK !!!!
obj = document.getElementById('option[]');
alert('object length '+obj.length);
for ( index = 0; index < obj.length; index++ )
{
testcode = obj[index].value;
if(code == testcode)
alert('found...');
}
}
then I print several input type like this:
//generated by PHP...$newvalue are new values at every checkbox (concat in
PHP is ".")
<input type="checkbox" name="option[]" value=".$newvalue."
onclick="CheckGroup(this)");>
Every checkbox is part of the option array (look at the name). In the
CheckGroup function, I try to retrieve all $newvalue from the option[]
array. So I try to retrieve every single item in the option[] array, but
unfortunately, it doesn't work.
alert(obj.length); show and undefined value.
How can I retrieve such items values ???