Checkbox.defaultChecked : CheckBox : Form JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Form » CheckBox »

 

Checkbox.defaultChecked










Syntax








document.form.checkbox.defaultChecked



The defaultChecked property holds the initial state of a check box as defined by the checked attribute of the tag.

It is a read-only Boolean value.












<html>
    <form name="orderForm">
      <input type="checkbox" name="door4">doors<br>
      <input type="checkbox" name="door2" checked>doors<hr>
      Step 2:
      <input type="button" value="Submit Order" name="orderButton" onClick="alert('submitted')">
      <input type="button" value="Reset Checkboxes" name="resetButton" onClick="resetCheckboxes()">
    </form>
    <script language="JavaScript">
    <!--
    function resetCheckboxes()
    {
      document.orderForm.door4.checked = document.orderForm.door4.defaultChecked;

      document.orderForm.door2.checked = document.orderForm.door2.defaultChecked;
    }
    -->
    </script>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Form
» CheckBox