--- title: window.onreset slug: Web/API/GlobalEventHandlers/onreset tags: - DOM - Gecko - Gecko DOM Reference - Window translation_of: Web/API/GlobalEventHandlers/onreset original_slug: Web/API/Window/onreset ---
フォームの reset イベントに対応するイベントハンドラです。
window.onreset = funcRef;
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<title>onreset のテスト</title>
<script>
function reg() {
window.onreset = hit;
}
function hit() {
alert('リセットイベントが発生しました。');
}
</script>
</head>
<body onload="reg();">
<form>
<div>
<textarea></textarea>
</div>
<div>
<input type="reset" value="reset" />
</div>
</form>
</body>
</html>
reset イベントは、ユーザがフォーム内のリセットボタン (<input type="reset"/>) をクリックした際に発生します。
標準仕様書には含まれていません。