Handler

Specifies event handlers which the XBL element responds to. You can provide default handling which can be overriden by an appropriate handler on the bound element. When the event occurs, the code contained in the action attribute or, if the action is not present, the content of the handler tag is executed.

More information about handler

Example:

    <handler event="keydown" keycode="VK_F3">
      alert('You pressed the F3 key! Good for you!');
    </handler>

XBL 要素が応答するイベントハンドラを指定する。結びつけられた要素に適切なハンドラをオーバライドできる、デフォルト処理を与えることができる。イベントが発生すると、action 属性のコードが実行される。あるいは action 属性が存在しないときは handler タグの内容が実行される。

handler の追加情報

例 :

    <handler event="keydown" keycode="VK_F3">
      alert('You pressed the F3 key! Good for you!');
    </handler>


属性:

action

The code contained in the action value is executed when the event occurs.

イベントが発生したとき、action の値のコードが実行される。

button

If set, the action is only called when the given mouse button is pressed. If this attribute is not used, it does not matter which button is pressed.

  • 0: the left mouse button
  • 1: the middle mouse button
  • 2: the right mouse button

設定すると、与えられたマウスボタンが押されたときにのみアクションは呼ばれる。この属性を使用しないときは、どのボタンが押されても問題ない。

  • 0: 左マウスボタン
  • 1: 中央マウスボタン
  • 2: 右マウスボタン
charcode

If set, the action is only called when the given character is pressed. If the key is not pressed, the event is ignored by this handler. If this attribute is not present and there is no keycode attribute, the handler is called no matter which key is pressed.

設定すると、与えられた文字が押されたときにのみアクションが呼ばれる。そのキーが押されなければ、イベントはこのハンドラでは無視される。この属性が無く keycode 属性も無ければ、どのキーが押されたかに関係なくハンドラは呼ばれる。

clickcount

Set to the number of mouse clicks that must occur for the action to be called. For example, if set to 2, the handler only get called on a double click of the mouse. Mozilla supports values 1, 2 and 3. The default is 1.

アクションを呼ぶのに必要なマウスクリックの回数を設定する。例えば 2 に設定すると、ハンドラはマウスをダブルクリックしたときにのみ呼ばれる。Mozilla は 1、2、3 の値をサポートしている。デフォルトは 1。

command

The id of a command to invoke when the event occurs. If used in a non-chrome document, the entire handler will be ignored.

イベントが発生したときに実行されるコマンドの id。非クロムドキュメントで使った場合、全ハンドラが無視される。

event

The event that the handler listens to. When the event occurs on the bound element, the code in the action attribute is executed. Two special events exist, bindingattached, which is called when the binding is bound to an element, and bindingdetached, which is called when the binding is removed from an element.

ハンドラが応答するイベント。結びつけられた要素でイベントが発生すると、 action 属性のコードが実行される。2 つの特別なイベント、bindingattached、bindingdetached がある。bindingattached は、バインディングが要素に結びつけられたときに発生する。bindingdetached は、バインディングが要素から取り除かれたときに発生する。

id

Type: element id, must be unique in the window

A unique identifier so that you can identify the handler with. You can use this as a parameter to getElementById and other DOM functions and to reference the element in style sheets.

型 : 要素 id。ウィンドウ内で一意でなければならない。

handler を識別できるユニークな識別子。getElementById や他の DOM 関数へのパラメータとして、またスタイルシートの要素への参照として使用することができる。

keycode

If set, the action is only called for a key event when the key with the given code is pressed.

設定すると、与えたコードのキーが押されたときのキーイベントにのみ、アクションが呼ばれる。

modifiers

Type: space separated list of the values below

A list of modifier keys that should be pressed to invoke the event. Multiple keys may be separated by spaces or commas. Keys will map to other keys on platforms that do not have them.

  • shift: The Shift key.
  • alt: The Alt key. On the Macintosh, this is the Option key.
  • meta: The Meta key. On the Macintosh, this is the Command key.
  • control: The Control key.
  • accel: The key used for keyboard shortcuts on the user's platform. Usually, this would be the value you would use.
  • accesskey: The menu access key.

型 : スペースで区切った以下の値のリスト

イベントを起動するために押されるべき修飾キーのリスト。複数のキーをスペースまたはカンマで区切ることができる。そのキーが無いプラットフォームでは、別のキーにマップされる。

  • shift: Shift キー。
  • alt: Alt キー。 Macintosh では Option キー。
  • meta: Meta キー。 Macintosh では Command キー。
  • control: Control キー。
  • accel: ユーザのプラットフォームでキーボードショートカットに用いるキー。通常、これが用いたい値となる。
  • accesskey: メニューアクセスキー。
phase

The event phase where the handler is invoked. This should be set to the value 'capturing' to indicate during the event capturing phase, 'target' to indicate at the target element or left out entirely for the bubbling phase. (A value of 'target' only works in Mozilla 1.4 and later.)

ハンドラが実行されるイベントフェイズ。次のどれかに設定するべきである。イベントキャプチャ・フェイズ中を示す値 'capturing' 、ターゲット要素にあるのを示す 'target' 、完全に無視するとバブル・フェイズを示す。('target' という値は Mozilla 1.4 以降でのみ動作する。)

preventdefault

If set to true, the default action of the event is not performed.

true に設定すると、イベントのデフォルトアクションは実行されない。


Copyright (C) 1999 - 2004 XulPlanet.com