HTML DOM type 屬性
定義和用法
type 屬性可返回表單元素的類型。Button 對象的類型始終是 "button"。
語法
buttonObject.type
實例
下面的例子將返回按鈕的表單元素類型:
<html>
<head>
<script type="text/javascript">
function alertType()
{
alert(document.getElementById("myButton").type
)
}
</script>
</head>
<body>
<form>
<input type="button" value="Click me!" id="myButton"
onclick="alertType()" />
</form>
</body>
</html>