Textbox

A text input field in which the user can enter text. It is similar to the HTML input element. Only one line of text is displayed by default. The multiline attribute can be specified to display a field with multiple rows.

More information about textbox

Example:

    <label control="your-name" value="Enter your name:"/>
    <textbox id="your-name"/>

HTML の input 要素と同様な、利用者がテキストを入力するためのテキスト入力欄。既定のふるまいでは、表示は 1 行のみであるが、 multiline 属性を指定して複数行にわたる表示をさせることができる。

textbox の追加情報

例 :

    <label control="your-name" value="Enter your name:"/>
    <textbox id="your-name"/>

属性:

cols disabled maxlength multiline onchange
oninput readonly rows size tabindex
timeout type value wrap

プロパティとメソッド:

accessible disabled inputField maxLength readonly
select selectionEnd selectionStart setSelectionRange size
textLength timeout type value

属性:

XUL Element から継承:

align
allowevents
allownegativeassertions
class
coalesceduplicatearcs
collapsed
container
containment
context
contextmenu
datasources
debug
dir
empty
equalsize
flags
flex
height
hidden
id
insertafter
insertbefore
left
maxheight
maxwidth
menu
minheight
minwidth
mousethrough
observes
ordinal
orient
pack
persist
popup
position
ref
removeelement
sortDirection
sortResource
sortResource2
statustext
style
template
tooltip
tooltiptext
top
uri
wait-cursor
width

cols

Type: integer

The number of columns in the textarea.

型 : integer

テキストエリアの列数。

disabled

Type: boolean

Indicates whether the textbox is disabled or not. If this attribute is set to true, the textbox is disabled. This is usually drawn with the text in grey. If the textbox is disabled, it does not respond to user actions. The element cannot be focused and the command event will not fire. The element will still respond to mouse events. To enable the textbox, leave the attribute out entirely as opposed to setting the value to false.

型 : boolean

textbox が無効か有効かを表す。この属性を true に設定すると、textbox は無効になる。通常、テキストが灰色で表示される。textbox が無効の場合には、ユーザアクションに応答しない。要素にフォーカスできず、またコマンドイベントは起きない。マウスイベントにはまだ応答する。 textbox を有効にするには、値を false に設定したことに対応するものとして、この属性を取り除く。

maxlength

Type: integer

The maximum number of characters that the textbox allows to be entered.

型 : integer

テキストボックスに入力が許されている最大文字数。

multiline

Type: boolean

If true, the textbox displays multiple lines. If the user presses ENTER, a new line is started. If false, the textbox only allows entry of one line.

型 : boolean

true の場合、テキストボックスは複数行の表示を行う。ユーザが ENTER を押すと、新しい行に移る。 false の場合、テキストボックスは 1 行のみ入力ができる。

onchange

Type: script code

This event is sent when the value of the textbox is changed. The event is not sent until the focus is moved to another element.

型 : script code

テキストボックスの値が変更されると、このイベントは送信される。別の要素にフォーカスが移動するまで、このイベントは送信されない。

oninput

Type: script code

This event is sent when a user enters text in a textbox. This event is only called when the text displayed would change, thus it is not called when the user presses non-displayable keys.

型 : script code

ユーザがテキストボックスにテキストを入力すると、このイベントは送信される。このイベントは表示テキストが変化したときにのみ呼ばれるため、ユーザが非表示キーを押したときには呼ばれない。

readonly

Type: boolean

If set to true, then the user cannot modify the value of the textbox. However, the value may still be modified by a script.

型 : boolean

true にした場合、ユーザはテキストボックスの値を変更することはできない。ただし、スクリプトから値を変更することはできる。

rows

Type: integer

The number of rows in the textarea.

型 : integer

テキストエリアの行数。

size

Type: integer

The number of characters that can be displayed in the textbox.

型 : integer

テキストボックスに表示可能な文字数。

tabindex

Type: integer

The tab order of the element. The tab order is the order in which the focus is moved when the user presses the Tab key. Elements with a higher tabindex are later in the tab order sequence.

型 : integer

要素のタブ順序。タブ順序は、ユーザがタブキーを押したときにフォーカスが移動する順番です。高い tabindex を持つ要素ほど、タブ順序の後のほうにくる。

timeout

Type: integer

For timed textboxes, the number of milliseconds before the timer fires a command event. The timer starts after the user types a character. If the user types another character, the timer resets.

型 : integer

タイマー付きテキストボックスにおける、タイマーが command イベントを送信するまでのミリ秒数。ユーザが文字を入力した後、タイマーが開始する。ユーザがまた別の文字入力を行った場合、タイマーはリセットされる。

type

Type: one of the values below

You can set the type attribute to one of the values below for a more specialized type of textbox. Don't set the type if you wish to use a regular textbox.

  • autocomplete: A textbox that supports autocomplete. For more information about autocomplete textboxes, see the autocomplete documentation (Mozilla) (Firefox)
  • password: A textbox that hides what is typed, used for entering passwords.
  • timed: This textbox will fire a command event after the user types characters and a certain time has passed. The delay is set with the timeout attribute. You might use this type, for instance, to update information elsewhere in the window as the user types, without the need for continuous updates since the timer will not fire if the user types more keys in the meantime. The command event will also fire if the user presses the return key.

型 : 以下の値の一つ

以下の値の一つを type 属性に設定すると、特殊な型のテキストボックスにすることができる。通常のテキストボックスを使用したい場合は type 属性を設定しないこと。

  • autocomplete: 自動補完をサポートするテキストボックス。自動補完テキストボックスについてさらに情報が欲しいときは、 autocomplete ドキュメントを参照 (Mozilla) (Firefox)
  • password: 何が入力されたかを隠すテキストボックスで、パスワードの入力に用いる。
  • timed: このテキストボックスは、ユーザが文字を入力してからある時間が経過した後、command イベントが発生する。この遅延は timeout 属性で設定する。この type を使用すると、例えばユーザの入力に応じて、ウィンドウのどこかの情報を更新することができる。このとき、その間にユーザがもっと入力した場合にはタイマーは発動しないため、連続更新が起きる必要性はない。ユーザが return キーを押した場合にも、command イベントは発生する。
value

Type: string

The default value entered in the textbox. The attribute only holds the default value and is never modified when the user enters text. To get the updated value, use the value property.

型 : string

テキストボックスに入力されているデフォルトの値。この属性はデフォルト値を保持するだけであり、ユーザのテキスト入力時に変更されることはない。修正された値を取得するには、 value プロパティを使用すること。

wrap

Type: string

Set this attribute to the value 'off' to disable word wrapping in the textbox. If this attribute is not specified, word wrapping is enabled.

型 : string

この属性を 'off' という値に設定すると、テキストボックスでワードのラップが無効になる。この属性を指定しない場合は、ワードラッピング (word wrapping) は有効である。


プロパティとメソッド:

XUL Element から継承:

align
allowEvents
blur
boxObject
boxObject.element
boxObject.getLookAndFeelMetric
boxObject.height
boxObject.screenX
boxObject.screenY
boxObject.width
boxObject.x
boxObject.y
builder
className
click
collapsed
contextMenu
controllers
database
datasources
dir
doCommand
flex
focus
getElementsByAttribute
height
hidden
id
left
maxHeight
maxWidth
menu
minHeight
minWidth
observes
ordinal
orient
pack
persist
ref
resource
statusText
style
tooltip
tooltipText
top
width

Element から継承:

addEventListener
appendChild
attributes
childNodes
cloneNode
dispatchEvent
firstChild
getAttribute
getAttributeNS
getAttributeNode
getAttributeNodeNS
getElementsByTagName
getElementsByTagNameNS
hasAttribute
hasAttributeNS
hasAttributes
hasChildNodes
insertBefore
isSupported
lastChild
localName
namespaceURI
nextSibling
nodeName
nodeType
nodeValue
normalize
ownerDocument
parentNode
prefix
previousSibling
removeAttribute
removeAttributeNS
removeAttributeNode
removeChild
removeEventListener
replaceChild
setAttribute
setAttributeNS
setAttributeNode
setAttributeNodeNS
tagName

accessible

Type: nsIAccessible

Returns the accessibility object for the textbox.

型 : nsIAccessible

textbox の accessibility オブジェクトを返す。

disabled

Type: boolean

Gets and sets the value of the disabled attribute.

型 : boolean

disabled 属性の値を取得・設定する。

inputField

Type: textbox element

In Mozilla, the XUL textbox is implemented as a wrapper around an HTML input element. This read only property holds a reference to this inner input element.

型 : textbox element

Mozilla では、 XUL の textbox は HTML の input 要素のラッパーとして実装されている。この読み込み専用プロパティは、内部の input 要素の参照を保持する。

maxLength

Type: integer

The maximum number of characters that the textbox allows to be entered.

型 : integer

テキストボックスに入力が許されている最大文字数。

readonly

Type: boolean

Gets and sets the value of the readonly attribute.

型 : boolean

readonly 属性の値を取得・設定する。

select ( )

Return Type: no return value

Select all the text in the textbox.

戻り値の型 : 戻り値なし

テキストボックスの全テキストを選択する。

selectionEnd

Type: integer

Get or modify the end of the selected portion of the field's text. Use in conjuction with the selectionEnd property. The value specifies the index of the character after the selection. If this value is equal to the selectionStart property, no text is selected, but the value indicates the position of the caret (cursor) within the textbox.

型 : integer

フィールドテキストの選択部分の終りを取得または変更する。selectionStart プロパティとともに使用する [訳注 : 原文では selectionEnd となっているが、selectionStart の間違いと思われる。conjuction も conjunction の間違いであろう。]。この値には選択部分の次の文字のインデックスを指定する。この値が selectionStart プロパティに等しい場合、テキストの選択はない。ただし、その値はテキストボックスのキャレット (カーソル) 位置を示す。

selectionStart

Type: integer

Get or modify the beginning of the selected portion of the field's text. Use in conjuction with the selectionEnd property. The value specifies the index of the first selected character.

型 : integer

フィールドテキストの選択部分の始まりを取得または変更する。selectionEnd プロパティとともに使用する。この値には最初の選択文字のインデックスを指定する。

setSelectionRange ( start , end )

Return Type: no return value

Sets the selected portion of the textbox, where the start argument is the index of the first character to select and the end argument is the index of the character after the selection. Set both arguments to the same value to move the cursor to the corresponding position without selecting text.

戻り値の型 : 戻り値なし

テキストボックスの選択部分を設定する。ここで、引数 start は設定する最初の文字のインデックスであり、引数 end は選択部分の次の文字のインデックスである。両引数とも同じ値に設定すると、選択テキストはなしで、対応する位置にカーソルを移動させる。

size

Type: integer

The number of characters that can be displayed in the textbox.

型 : integer

テキストボックスに表示可能な文字数。

textLength

Type: integer

Holds the length of the text entered in the textbox. This property is read only.

型 : integer

テキストボックスに入力されたテキストの長さを保持する。このプロパティは読み込み専用である。

timeout

Type: integer

Gets and sets the value of the timeout attribute.

型 : integer

timeout 属性の値を取得・設定する。

type

Type: one of the values below

You can set the type attribute to one of the values below for a more specialized type of textbox. Don't set the type if you wish to use a regular textbox.

  • autocomplete: A textbox that supports autocomplete. For more information about autocomplete textboxes, see the autocomplete documentation (Mozilla) (Firefox)
  • password: A textbox that hides what is typed, used for entering passwords.
  • timed: This textbox will fire a command event after the user types characters and a certain time has passed. The delay is set with the timeout attribute. You might use this type, for instance, to update information elsewhere in the window as the user types, without the need for continuous updates since the timer will not fire if the user types more keys in the meantime. The command event will also fire if the user presses the return key.

型 : 以下の値の一つ

以下の値の一つを type 属性に設定すると、特殊な型のテキストボックスにすることができる。通常のテキストボックスを使用したい場合は type 属性を設定しないこと。

  • autocomplete: 自動補完をサポートするテキストボックス。自動補完テキストボックスについてさらに情報が欲しいときは、 autocomplete ドキュメントを参照 (Mozilla) (Firefox)
  • password: 何が入力されたかを隠すテキストボックスで、パスワードの入力に用いる。
  • timed: このテキストボックスは、ユーザが文字を入力してからある時間が経過した後、command イベントが発生する。この遅延は timeout 属性で設定する。この type を使用すると、例えばユーザの入力に応じて、ウィンドウのどこかの情報を更新することができる。このとき、その間にユーザがもっと入力した場合にはタイマーは発動しないため、連続更新が起きる必要性はない。ユーザが return キーを押した場合にも、command イベントは発生する。
value

Type: string

Returns the text entered into the textbox. You can set this property to change the text in the textbox.

型 : string

テキストボックスに入力されたテキストを返す。このプロパティを設定すると、テキストボックスのテキストを変更することができる。


Copyright (C) 1999 - 2004 XulPlanet.com