Checkbox type 屬性

定義和用法
type 屬性可返回元素的表單類型。
對于一個 checkbox 對象,該屬性總是返回 "checkbox"。
語法
checkboxObject.type
瀏覽器支持
所有主要瀏覽器都支持 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>
<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>
嘗試一下 ?

更多建議: