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