Reset typeプロパティ
Reset オブジェクト
定義と使い方
type プロパティはリセットボタンのフォーム要素タイプを返します。
確認ボタンに対して、このプロパティは常に "reset" です。
構文
resetObject.type
ブラウザサポート
![]()
![]()
![]()
![]()
![]()
すべての主要ブラウザは type プロパティをサポートしています。
例
例
次の例は、リセットボタンのフォーム要素タイプを返します:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>サンプル(example.com)</title>
<script>
function displayResult(){
var x=document.getElementById("reset1").type;
alert(x);
}
</script>
</head>
<body>
<form>
Email: <input type="text" id="email">
<input type="reset" id="reset1">
</form>
<button type="button" onclick="displayResult()">input タイプを表示</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>サンプル(example.com)</title>
<script>
function displayResult(){
var x=document.getElementById("reset1").type;
alert(x);
}
</script>
</head>
<body>
<form>
Email: <input type="text" id="email">
<input type="reset" id="reset1">
</form>
<button type="button" onclick="displayResult()">input タイプを表示</button>
</body>
</html>
試してみる »
Reset オブジェクト その他の拡張