Syntax
document.form.checkbox.name
The name property provides access to the name attribute of the check box.
This property is a read-only string.
<html>
<form name="orderForm">
<input type="checkbox"
name="V6">V6<br>
<input type="checkbox"
name="V8">V8<hr>
Step 2:
<input type="button"
value="Submit Order"
name="orderButton"
onClick="submitOrder()">
</form>
<script language="JavaScript">
<!--
function submitOrder()
{
var alertString = String("You have selected a ");
if(document.orderForm.V6.checked == true)
alertString += document.orderForm.V6.name;
else
alertString += document.orderForm.V8.name;
alertString += " truck.";
alert(alertString);
}
-->
</script>
</html>