34,333
edits
Changes
→JavaScript Check Boxes
== JavaScript Check Boxes ==
The Check Box object creates a small square that changes between a checked and uncheked state when clicked. Check Boxes are ideal for porviding the user with a "Yes" or "No" choice.
The Check Box object uses the ''<input>'' tag as follows:
<pre>
<form action="" name="orderForm">
<input type="CHECKBOX" name="mailListBox" checked>Add me to the mailing List.
</pre>
The ''checked'' attribute states whether the box should be checked by default when it is first created.
The current setting of a CheckBox can be obtained by accessing the ''checked'' property of tyeh object. For example:
<pre>
if (document.orderForm.mailListBox.checked)
</pre>