I am producing a form using PHP on the back end and Javascript on the front end. The resulting script will come to the browser as follows:
<script>
<!--
function selectAll() {
moveElement = eval("document.imageForm.move" + "[]");
alert(moveElement);
if (document.imageForm.select_all[0].checked) {
for (i = 0; i < document.imageForm.move.length; i++) {
document.imageForm.move.checked = true;
}
}
}
function deSelectAll() {
if (!document.imageForm.select_all[0].checked || document.imageForm.deselect_all[0].checked) {
for (i = 0; i < document.imageForm.move.length; i++) {
document.imageForm.move.checked = false;
}
}
}
//-->
</script>
This will work with a checkbox group that has to have this naming convention for PHP:
<input type=checkbox name=move[] value="myImage.gif"> - Move?
I will also have a checkbox that will "select all" and "de-select all":
<input type=checkbox name=select_all value=1 onChange="selectAll()"> - Select All
<input type=checkbox name=deselect_all value=1 onChange="deSelectAll()"> - De-select All
I am not familiar at how Javascript can work with non-standard naming conventions for event actions, can someone tell me what I'm doing wrong? This fails at least in Mozilla 1.6
Thanx
Phil