I have read through loads of comments about how and why object expected can be reported, but I think my problem is that my javascript and calls are rubbish.
I want to build a simple function that, if I de-select the first check box, all other checkboxes are de=seleceted, or if I select one of the other checkboxes and not the forst check box, the first checkbox will automatically be selected.
I have this working fine when i use the checkbox input name in the javascript (all checkboxes except the first have the same name), but as I want to pass each input to a php function for processing, so I need different input names. So, in my wisdom, I thought why not add an id to each field and use the GetElementById function.
below is my attempt: ANY advice is more than welcome. Thank you.
<head>
<SCRIPT text/javascript>
function Check1(chk)
{
if(document.myform3.Check_ctr.checked==false){
chk.checked = false ;
}
}
function Check2(chk)
{
chk.checked=true;
}
</script>
<body>
<form name="myform3" method="post" action="post_php">
<table align="center" width="370px" border="0">
<tr>
<td width="250px">Item</td>
<td align="center" valign="middle">Tick to Display</td>
</tr>
<tr>
<td>Project Name: </td>
<td align=center valign=middle><input type="checkbox" name="Check_ctr" value="yes" onclick="Check1(document.myform3.getElementById('check_list'))" /></td>
</tr>
<tr>
<td> </td>
<td valign=middle align=center><input type="checkbox" name="checkbox" value="1" id="check_list" onclick="check2(document.myform3.Check_ctr)"/></td>
</tr>
<tr>
<td> </td>
<td valign=middle align=center><input type="checkbox" name="checkbox" value="1" id="check_list" onclick="check2(document.myform3.Check_ctr)"/></td>
</tr>
<tr>
<td> </td>
<td valign=middle align=center><input type="checkbox" name="checkbox" value="1" id="check_list" onclick="check2(document.myform3.Check_ctr)"/></td>
</tr>
</table>
<input type="submit" name="submit" value="Save Changes" />