Hi all,
i got a problem here in this Javascipt code to check all the checkbox with an array name of orderitem[]:
the code above works fine in IE and Opera but not in Firefox.HTML Code:function checkAll(myform) { var field = document.getElementsByTagName("orderitem"); for (i = 0; i < field.length; i++) field[i].checked = true ; } var formblock; var forminputs; function prepare() { formblock= document.getElementById('myform'); forminputs = formblock.getElementsByTagName('input'); } function select_all(name, value) { for (i = 0; i < forminputs.length; i++) { // regex here to check name attribute var regex = new RegExp(name, "i"); if (regex.test(forminputs[i].getAttribute('name'))) { if (value == '1') { forminputs[i].checked = true; document.myform.total.value = document.myform.totalamount.value; } else { forminputs[i].checked = false; document.myform.total.value = 0; } } } } if (window.addEventListener) { window.addEventListener("load", prepare, false); } else if (window.attachEvent) { window.attachEvent("onload", prepare) } else if (document.getElementById) { window.onload = prepare; }
I really don't know what's the problem here.![]()
anyone?
Thanks.







Bookmarks