www.fgks.org   »   [go: up one dir, main page]

Click to Rate and Give Feedback
Properties
 checked Property
CHECKED Attribute | checked Property

Sets or retrieves the state of the check box or radio button.

Syntax

HTML<ELEMENT CHECKED ... >
Scripting[ bChecked = ] object.checked

Possible Values

bCheckedBoolean that specifies or receives one of the following values.
falseDefault. Control is not selected.
trueControl is selected.

The property is read/write. The property has a default value of false.

Remarks

Check boxes that are not selected do not return their values when the form is submitted.

A user can select a radio button only if the button has a name. To clear a selected radio button, a user must select another button in the set.

Example

This example retrieves the checked property to fire an event.

<head>
    <script>
    function checkthis()
    {
        if (oCheckbox.checked == true)
        {
            window.open("http://www.microsoft.com");
        }
    }
    </script>
</head>

<body>

    <p>Check here if you wish to go to Microsoft:
    <input id="oCheckbox" type="checkbox" ></p>

</body>
This feature requires Microsoft® Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

This property is defined in HTML 3.2 World Wide Web link and is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 World Wide Web link.

Applies To

INPUT type=checkbox, INPUT type=radio

See Also

defaultChecked, Introduction to Forms
Tags What's this?: Add a tag
Community Content
 
Add Community Content
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker
DCSIMG