<html>
<form name="orderForm">
<input type="checkbox"
name="peppers">Peppers<br>
<input type="checkbox"
name="sausage">Sausage<br>
<input type="checkbox"
name="onion">Onion<br>
<input type="checkbox"
name="bacon">Bacon<hr>
<input type="button"
value="Order Pizza"
name="orderButton"
onClick="alert('ordered.')">
</form>
<script language="JavaScript">
<!--
var counter = 0;
for(var x=0; x<document.orderForm.length; x++)
{
if(document.orderForm.elements[x].type == "checkbox")
{
counter++;
}
}
document.write("Please select no more than 2 of the ");
document.write(counter," possible toppings.");
-->
</script>
</html>
|