Property
Declares a JavaScript property that is added to the element's object. The property element may have a getter child element and a setter child element to get and set the value of the property respectively.
For example, you might want to add a selected property to a drop-down box. Properties make it convenient if an object is going to be used a lot with scripts.
The property element may have content which is code that determines the initial value of the property.
要素のオブジェクトに追加する JavaScript プロパティを宣言する。property 要素は、プロパティ値を取得・設定するために getter 子要素と setter 子要素を持つことができる。
例えば、selected プロパティをドロップダウンボックスに追加したくなるかもしれません。オブジェクトがスクリプトでたくさん使われるのであれば、プロパティを使うと便利になります。
property 要素は内容を持ちます。それはプロパティの初期値を決めるコードです。
属性:
id
Type: element id, must be unique in the window
A unique identifier so that you can identify the property with. You can use this as a parameter to getElementById and other DOM functions and to reference the element in style sheets.
型 : 要素 id。ウィンドウ内で一意でなければならない。
property を識別できるユニークな識別子。getElementById や他の DOM 関数へのパラメータとして、またスタイルシートの要素への参照として使用することができる。
name
The name of the property, which is the name that can be used via a script. For example, if a property has the name color, it can be accessed with object.color, where object is a reference to the object.
property の名前。スクリプトで用いられる名前のこと。例えば、property が color という名前を持っているとき、object.color でアクセスできます。ここで object はオブジェクトへの参照です。
onget
The code contained in the onget attribute is called when an attempt is made to retrieve the value of the property. You may use this attribute when only a simple script is required. For longer scripts, you should use the getter element, which functions similarly. The onget code should return the value of the property.
onget 属性に含まれるコードは、プロパティの値を取得しようと試みられたときに呼ばれる。単純なスクリプトが必要とされるときにのみ、この属性を使うことができる。長いスクリプトの場合には、 getter 要素を使用するべきである。これは同様に機能する。onget コードはプロパティの値を返すべきである。
onset
The code contained in the onset attribute is called when an attempt is made to modify the value of the property. You may use this attribute when only a simple script is required. For longer scripts, you should use the setter element, which functions similarly. Within the code of the onset attribute, the variable val is set to the value that the property should be changed to.
onset 属性に含まれるコードは、プロパティの値を変更しようと試みられたときに呼ばれる。単純なスクリプトが必要とされるときにのみ、この属性を使うことができる。長いスクリプトの場合には、 setter 要素を使用するべきである。これは同様に機能する。onset 属性のコードでは、プロパティが変更される値に変数 val が設定される。
readonly
If set to true, the value of the property cannot be changed. If set to false, the property may be changed.
true に設定すると、プロパティの値は変更できない。false に設定すると、プロパティを変更できる。