I am trying to get this code to pop up a confirm box if either one or many checkboxes in the array are checked. But I only want it to pop up once regardless if there is only one checkbox or many checked.
It is doing two things wrong:
When there is only one checkbox it does not pop up at all.
When there are many checkboxes it is popping up a confirm box for each checkbox.
function checkform(){
<!--
for (i=0; i<document.Form1.CancelClass.length; i++)
if (document.Form1.CancelClass[i].checked)
{
var answer = confirm ("Are you sure you want to cancel a class?")
if (answer)
{
document.Form1.submit();
}
else
return false;
}
}
I would appreciate any help. Thanks