在javascript中,checked是什么意思?怎么用?

chst 2006-01-01 12:53:38
在javascript中,checked是什么意思?怎么用?盼高手指点迷津!
...全文
1651 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Aallonlin 2006-01-03
  • 打赏
  • 举报
回复
checked 复选框或选项按钮(单选按钮)的状态

表示是否选中当前项.
梅雪香 2006-01-01
  • 打赏
  • 举报
回复

CHECKED Attribute | checked Property Internet Development Index

--------------------------------------------------------------------------------

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

Syntax

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

Possible Values

bChecked Boolean that specifies or receives one of the following values.false Default. Control is not selected.
true Control 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.

HideExample

<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>
Show Me
Standards Information

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

Applies To

[ Object Name ]
Platform Version
Win16:
Win32:
Windows CE:
Unix:
Mac:
Version data is listed when the mouse hovers over a link, or the link has focus.
INPUT type=checkbox, INPUT type=radio
Move the mouse pointer over an element in the Applies To list to display availability information for the listed platforms.

See Also

defaultChecked, Introduction to Forms


关于日期的常见操作
http://community.csdn.net//Expert/TopicView2.asp?id=4360247&datebasetype=now
js FAQ贴
http://community.csdn.net//Expert/TopicView2.asp?id=4356360&datebasetype=now
DHTML手册,js手册,dom手册下载
http://community.csdn.net//Expert/TopicView2.asp?id=4356325&datebasetype=now
pli0825 2006-01-01
  • 打赏
  • 举报
回复
checked是单选按钮,复选框等的属性,表明是否选中。

直接用document.getElementById("radio_id").checked = true或者false来设置即可

也可以进行条件判断

87,992

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧