I’m not with JavaScript, but I have grasped the basic idea of it, however the only problem I have is working with checkboxes.
I have this code (written by myself) that is supposed to check all checkboxes in a form:
<script>
<!–
function checkall(formname, checkAllId, checkid) {
var checkAll = eval(“document.forms.” + formname + “.” checkAllId);
var checkObj = eval(“document.forms.” + formname + “.” + checkid);
var checkedState;
if(checkAll.checked) {
checkedState = 1;
} else {
checkedState = 0;
}
// Loop through all checkboxes
for(i = 0; i < checkObj.length; i++) {
checkObj[i].checked = checkedState;
}
}
//–>
</script>
and here is the HTML:
<form name= “checkboxgroup”>
<!– Checkbox used to check ALL checkboxes in our form –>
<input type= “checkbox” name= “select1” onClick= “checkall(‘checkboxgroup’, ‘select1’, ‘cb’)” />Check or uncheck all?<br />
<input type= “checkbox” name= “cb” /><br />
</form>
<!– END CODE –>
That is just a small example.
I know what I am doing, yet I dont. ?
What am I doing wrong, what could I possibly do to fix this?
Thanks! Any help is greatly appreciated! ?
— John