Click to return to the DHTML, HTML     
CELLSPACING Attribute | c...     CLASSID Attribute | class...     DHTML Properties    
Web Workshop  |  DHTML, HTML & CSS

CHECKED Attribute | checked Property


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

Syntax

HTML<ELEMENT CHECKED = bChecked ... >
Scriptinginput.checked [ = bChecked ]

Possible Values

bChecked Boolean that specifies one of the following values:
falseControl is not selected.
trueControl is selected.

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

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see Dynamic Properties.

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.

Sample Code

<HEAD>
<SCRIPT>
function checkthis()
{
    if (oCheckbox.checked == true)
    {
        alert("It's got a check; now off to Microsoft!");
        window.open("http://www.microsoft.com");
    }
}
</SCRIPT> 
</HEAD>
<BODY>
Check here if you wish to go to Microsoft:
<INPUT ID=oCheckbox TYPE=checkbox onclick=checkthis()>
</BODY>

This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
INPUT TYPE=checkbox, INPUT TYPE=radio

See Also

defaultChecked, Forms Overview


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.