Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
function checkCheckboxes()
{
var cbs = document.getElementById("idOfMyCheckboxes");
var noneChecked = true;
for(var i=0; i<cbs.length; i++)
{
if(cbs[i].checked)
{
noneChecked = false;
break;
}//end if
}//end for
if(noneChecked)
{
alert('You must check at least one checkbox!');
return false;
}//end if
else
return true;
}//end checkCheckboxes()
<script language=JavaScript>
function checkFunction() {
var checks = document.getElementsByTagName("input");
for (i = 0; i < checks.length; i++) {
if (checks[i].type == "checkbox") {
if (checks[i].checked) {
return (true);
}
}
}
return (false);
}
</script>
<body>
<form name=blahForm onsubmit='alert ((checkFunction()) ? "passed" : "failed")'>
<input type=checkbox>Apples<br>
<input type=checkbox>Oranges<br>
<input type=checkbox>Bananas<br>
<input type=checkbox>Pears<br>
<input type=checkbox>Cherries<br>
<input type=checkbox>Grapes<br>
<input type=submit value='Submit'>
</form>
</body>