HTML DOM 버튼 유형 속성
정의 및 사용
속성 세트를 입력하거나 버튼의 형태를 돌려줍니다.
팁 : 버튼 타입의 속성에 대해 항상 규정을 준수해야합니다.인 다른 브라우저에서 (뿐만 아니라 W3C 사양) "제출"동안 IE 브라우저의 기본 유형은, "버튼"입니다.
문법
buttonObject.type=value
type 속성은 다음의 값을 지정할 수 있습니다 :
值 | 描述 |
---|---|
submit | button 是提交按钮(是 IE 之外的所有浏览器的默认值) |
button | button 是可点击的按钮(IE 的默认值) |
reset | button 是重置按钮(清除表单数据) |
브라우저 지원
모든 주요 브라우저 유형 속성을 지원합니다.
예
예
입력 버튼을 돌려줍니다 :
<html>
<head>
<script>
function alertType()
{
alert(document.getElementById("myButton").type)
}
</script>
</head>
<body>
<button id="myButton" type="button" onclick="alertType()">Click Me!</button>
</body>
</html>
<head>
<script>
function alertType()
{
alert(document.getElementById("myButton").type)
}
</script>
</head>
<body>
<button id="myButton" type="button" onclick="alertType()">Click Me!</button>
</body>
</html>
»시도
버튼 객체