| 技 巧 鍵 盤 | ─ KeyNavi:キーボードを活用してホームページを快適に─ |
| ■ キー割当表示[Shift-H] |
|
|
・サイトマップ [Shift-S] |
このaddボタンのonclickハンドラに 現在のテキストボックスの中身をalert()で表示する関数を追加してみます。
上記を実行後 addボタンを押すと既定ハンドラと追加したものの両方が 動くことが分かります。 既定のハンドラが上書きされないので コード管理がラクになります。
| イベントハンドラ名 | 登録先オブジェクト | 該当イベント |
| onfocus | フォーム各種 | フォーカスされた |
| onblur | フォーム各種 | フォーカスが外れた |
| onmousedown | フォーム各種 | マウスボタンが押された |
| onmouseup | フォーム各種 | 押されたマウスボタンが押し戻された |
| onclick | リンク、フォーム各種 | クリックが実行された (マウスボタンが上げられる瞬間発生) |
| onmouseover | リンク | マウスがリンク領域に重なった |
| onmouseout | リンク | マウスがリンク領域から外に出た |
| onkeydown | テキスト系フォーム | キーが押された(一度のみ呼ばれる) |
| onkeypress | テキスト系フォーム | キーが押された状態(押されている間 何度も呼ばれる) |
| onkeyup | テキスト系フォーム | キーが押された状態から戻された(一度のみ呼ばれる) |
| onselect | テキスト系フォーム | テキストが(マウスドラッグ等で)選択された |
| onchange | フォーム各種 | 値が変わった |
| onsubmit | <form>タグ | フォームの送信される(送信ボタンが押された) |
| onreset | <form>タグ | フォームのResetボタンが押された |
イベントハンドラは他にも沢山有り下記スクリプトで調べられます。
以下はIE6での実行結果です。 上のスクリプトを実行したら書き換えられます。
| onactivate | null |
| onafterupdate | null |
| onbeforeactivate | null |
| onbeforecopy | null |
| onbeforecut | null |
| onbeforedeactivate | null |
| onbeforeeditfocus | null |
| onbeforepaste | null |
| onbeforeupdate | null |
| onblur | null |
| oncellchange | null |
| onclick | null |
| oncontextmenu | null |
| oncontrolselect | null |
| oncopy | null |
| oncut | null |
| ondataavailable | null |
| ondatasetchanged | null |
| ondatasetcomplete | null |
| ondblclick | null |
| ondeactivate | null |
| ondrag | null |
| ondragend | null |
| ondragenter | null |
| ondragleave | null |
| ondragover | null |
| ondragstart | null |
| ondrop | null |
| onerrorupdate | null |
| onfilterchange | null |
| onfocus | null |
| onfocusin | null |
| onfocusout | null |
| onhelp | null |
| onkeydown | null |
| onkeypress | null |
| onkeyup | null |
| onlayoutcomplete | null |
| onlosecapture | null |
| onmousedown | null |
| onmouseenter | null |
| onmouseleave | null |
| onmousemove | null |
| onmouseout | null |
| onmouseover | null |
| onmouseup | null |
| onmousewheel | null |
| onmove | null |
| onmoveend | null |
| onmovestart | null |
| onpage | null |
| onpaste | null |
| onpropertychange | null |
| onreadystatechange | null |
| onreset | null |
| onresize | null |
| onresizeend | null |
| onresizestart | null |
| onrowenter | null |
| onrowexit | null |
| onrowsdelete | null |
| onrowsinserted | null |
| onscroll | null |
| onselectstart | null |
| onsubmit | null |
|
【JavaScript@Keynavi.Net :
一般イベント処理編
】
「Ctrl-矢印」でフォーカスを上下左右に移動できます。
|
| トップへ戻る [1] | Back[Q] ・Top[W] ・Up[E] ・PgUp[R] ・Focus[Ctrl-矢印] |
|
|
・サイトマップ [Shift-S] |
| ■ キー割当表示[Shift-H] | ─ KeyNavi Project 2003 ─ |