|
checkBox issue
i'm trying to simulate a click on a checkbox from an outside button.
in the code below the button marks the checkBox as "checked" but does'nt call the checkBox's onClick() function. i also tried onChange() but still it didnt work.
is there a way to do that?
function showCheckBoxValue(a)
{
alert(a.value);
}
function clickCheckBox()
{
frm = document.forms['form1'];
frm['checkbox1'].checked = true;
}
</script>
<form action="" method="post" name="form1">
<input type="hidden" name = "colors" value="1">
<input type="checkbox" name="checkbox1" value="5" onClick="showCheckBoxValue(this)">
<input type="button" name="a" onClick="clickCheckBox()">
</form>
|