Method

Declares a JavaScript method that is added to the element's object. The method may take arguments, declared with the parameter element.

For example, an element that allows text to be selected might have getSelected and setSelected methods.

The example below is a method toUpper that, when called, will make the value attribute uppercase.

More information about method

Example:

    <method name="toUpper">
      <body>
        var v = this.getAttribute("value");
        if (v != null) this.setAttribute("value",v.toUpperCase());
      </body>
    </method>

要素のオブジェクトに追加する JavaScript メソッドを宣言する。メソッドは、 parameter 要素で宣言される引数を持つことができる。

例えば、テキストを選択できるようにした要素は getSelected メソッドと setSelected メソッドを持つでしょう。

下に示す例は、呼ばれると value 属性を大文字にするメソッド toUpper である。

method の追加情報

例 :

    <method name="toUpper">
      <body>
        var v = this.getAttribute("value");
        if (v != null) this.setAttribute("value",v.toUpperCase());
      </body>
    </method>

属性:

id name

属性:

id

Type: element id, must be unique in the window

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

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

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

name

The name of the method, which is the name used in a script. For example, a method named setSize can accessed with object.setSize().

method の名前。スクリプトで用いられる名前のこと。例えば、 setSize と名付けられた method は object.setSize() でアクセスできる。).


Copyright (C) 1999 - 2004 XulPlanet.com