とほほのJavaScript入門(フォーム関連)

HOME > とほほのWWW入門 > とほほのJavaScript入門 > フォーム関連
1998年2月15日版

フォーム(window.document.forms)

[window.]document.forms (N2/e3)
フォームオブジェクトの配列。

[window.]document.forms.length (N2/e3)
フォームオブジェクトの配列の個数。

[window.]document.form (N2/e3)
個々のフォームオブジェクト。 例えば <FORM NAME=form1> と生成したフォームは、次のいずれかの書式で指定する。(0 はドキュメント中の最初のフォームを表す)
  document.forms[0]
  document.forms["form1"]
  document.form1

[window.]document.form.action (N2/e3)
<FORM ACTION=〜>で指定したアクション。 R/W可。(IE3はRのみ)

[window.]document.form.encoding (N2/e3)
<FORM ENCTYPE=〜>で指定したエンコードタイプ。

[window.]document.form.length (N2/e3)
[window.]document.form.elements.length と同じ。

[window.]document.form.method (N2/e3)
<FORM METHOD=〜>で指定した通信タイプ。

[window.]document.form.name (N2/e3)
<FORM NAME=〜>で指定したフォーム名。

[window.]document.form.target (N2/e3)
<FORM TARGET=〜>で指定したターゲットウィンドウ。

[window.]document.form.handleEvent(event) (N4)
フォームのイベントハンドラを呼び出す。

[window.]document.form.reset() (N3/e4)
リセットボタンを押したのと同じ効果を起こす。

[window.]document.form.submit() (N2/e3)
サブミットボタンを押したのと同じ効果を起こす。

フォーム部品(window.document.form.elements)

[window.]document.form.elements (N2/e3)
フォームを構成するエレメントオブジェクト(入力フィールドなどの総称)の配列。

[window.]document.form.elements.length (N2/e3)
フォームを構成するエレメントオブジェクトの配列の個数。

[window.]document.form.element (N2/e3)
フォームを構成する個々のエレメントオブジェクト。 次のいずれかの書式で指定する。
  document.form1.text1 ... text1はNAMEで指定した名前
  document.form1.elements[0] ... 0はオブジェクトの通し番号

[window.]document.form.element.checked (N2/e3)
checkbox, radioに有効。現在チェックされているかどうか(true|false)。

[window.]document.form.element.defaultChecked (N2/e3)
checkbox, radioに有効。初期値としてチェックされていたかどうか(true|false)。

[window.]document.form.element.defaultValue (N2/e3)
password, text, textareaに有効。初期値として表示されていた文字列。

[window.]document.form.element.form (N2/e3)
button, checkbox, file, hidden, password, radio, reset, select, submit, text, textareaに有効。このエレメントを包含するフォームオブジェクト。

[window.]document.form.element.length (N2/e3)
selectに有効。オプションオブジェクトの個数。 [window.]document.form.element.options.lengthと同じ。

[window.]document.form.element.name (N2/e3)
button, checkbox, file, hidden, password, radio, reset, select, submit, text, textareaに有効。このエレメントの名前。

[window.]document.form.element.options (N2/e3)
selectに有効。<OPTION>に対応するオプションオブジェクトの配列。

[window.]document.form.element.options.length (N2/e3)
selectに有効。<OPTION>に対応するオプションオブジェクトの配列の個数。

[window.]document.form.element.option (N2/e3)
selectに有効。個々のオプションオブジェクト。document.form1.select1.options[0] のように指定する。

[window.]document.form.element.option.defaultSelected (N2/e3)
初期値として選択されていたかどうか(true|false)。

[window.]document.form.element.option.selected (N2/e3)
現在選択されているかどうか(true|false)。

[window.]document.form.element.option.text (N2/e3)
オプションとして表示されている文字列。

[window.]document.form.element.option.value (N2/e3)
フォーム値として送信される値。

[window.]document.form.element.selectedIndex (N2/e3)
selectに有効。現在選択されているオプションオブジェクトを示すインデックス番号。 これに値を代入することにより、セレクションボックスの選択項目を変更することができる。

[window.]document.form.element.type (N3/e4)
button, checkbox, file, hidden, password, radio, reset, select, submit, text, textareaに有効。このエレメントのタイプ。

[window.]document.form.element.value (N2/e3)
button, checkbox, file, hidden, password, radio, reset, select(IEのみ?), submit, text, textareaに有効。 ボタン(button, submit, reset)の場合はボタンに表示される文字列、それ以外の場合はフォームの入力結果として送信されるエレメントの値。

[window.]document.form.element.blur() (N2/e3)
button, checkbox, file, password, radio, reset, select, submit, text, textareaに有効。このエレメントからフォーカスをはずす。

[window.]document.form.element.click() (N2/e3)
button, checkbox, radio, reset, submitに有効。このエレメントをクリックしたことにする。

[window.]document.form.element.focus() (N2/e3)
button, checkbox, file, password, radio, reset, select, submit, text, textareaに有効。このエレメントにフォーカスを移す。

[window.]document.form.element.handleEvent(event) (N4)
button, checkbox, file, password, radio, reset, select, submit, text, textareaに有効。 フォーム部品のイベントハンドラを呼び出す。

[window.]document.form.element.select() (N2/e3)
fileに有効。

Copyright(C) とほほ ( http://www2e.biglobe.ne.jp/~s-hasei/ )