Javascript variables are not working
- by linkcool
Hi, my problem is that my variables are not working in javascript.
all variables need names without some character at the beginning, this is the stupid thing...Anyways, im trying to make a funtion that makes "select all checkboxes". It is not working so i looked at the page source/info and found out that the variables were not changing.
this is my input:
echo "<input onclick='checkAll(1);' type='checkbox' name='master'/><br/>";
My function:
function checkAll(i)
{
for(var i=1; i < <?php echo $num; ?>; i++)
{
if(document.demo.master[i].checked == true)
{
document.demo.message[i].checked = true;
}
else
{
document.demo.message[i].checked = false;
}
}
}
so yes that's it. I can tell you that i also tried without the <i> in: checkAll("i")
Thanks for the help.