Checkbox type 属性

Checkbox 对象参考手册 Checkbox 对象

定义和用法

type 属性可返回元素的表单类型。

对于一个 checkbox 对象,该属性总是返回 "checkbox"。

语法

checkboxObject.type


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持 type 属性


实例

实例

下面的例子返回了 checkbox 的表单元素类型:

<html>
<head>
<script>
function displayResult()
{
var x=document.getElementById("check1").type;
alert(x);
}
</script>
</head>
<body>

<form>
<input type="checkbox" id="check1">Do you like summer?
</form>

<button type="button" onclick="displayResult()">Display input type</button>

</body>
</html>

尝试一下 »


Checkbox 对象参考手册 Checkbox 对象