Originally posted by kumar:
Hi Everybody,
I have 2 diffrent check boxes i need to get the status of those checkboxes.
Here the below code
Javascript
function ClickRows(obj)
{
var i=0;
var chxbox1=document.getElementsByName("CheckBox1");
var chxbox2=document.getElementsByName("CheckBox2");
if (obj.checked==true)
{
chxbox1[i].checked=true;
chxbox2[i].checked=true;
}
else
{
chxbox1[i].checked=true;
chxbox2[i].checked=true;
}
JSP
"& lt;"INPUT type="CHECKBOX" name="CheckBox1"& lt;"%=i%"& lt;""
value="Y" "Rows_Click(this)" "& lt;"
"& lt;"INPUT type="CHECKBOX" name="CheckBox2"& lt;"%=i%"& lt;""
value="Y" "Rows_Click(this)"
It's giving as
"undefined is null not an object"
Please help me out.
Thanks in advance.
-----------------------------------
I have R&D over your code and reached the result:
code:
function ClickRows(obj)
{
alert(" the value of the check box is"+obj.checked);//this will return the status of the check box
alert(" the value of the check box is"+obj.name);//this will give the name of the check box
var i=0;
//var chxbox1=document.getElementsByName("CheckBox1");
//var chxbox2=document.getElementsByName("CheckBox2");
var chxbox1=chxbox1[0].checked;
var chxbox2=chxbox2[0].checked;
alert(" The value of first checkBox"+chxbox1+"The value of the second ChecKBox"+chxbox2);
alert("the value of the first checkbox "+chxbox1[0].checked+" And the checkbox2"+chxbox2[0].checked);
if (obj.checked==true)
{
chxbox1[i].checked=true;
chxbox2[i].checked=true;
}
else
{
chxbox1[i].checked=true;
chxbox2[i].checked=true;
}
}
I have not attached the HTML CODE because gave some error in javaranch
by