document.forms[n].name = Name document.forms[n].elements[n].name = Name document.forms[n].elements[n].value = Value Length= document.forms.length Name = document.forms[n].name Length= document.forms[n].elements.length Name = document.forms[n].elements[n].name Type = document.forms[n].elements[n].type Value = document.forms[n].elements[n].value |
名前を設定 名前を設定 値を設定 数を返す 名前を取得 数を返す 名前を取得 タイプを取得 値を取得 | |
Form = document.forms[n].elements[n].form Form = document.FormObject.ElementsObject.form Form = this.form 上記3つどの指定方法でも、フォームオブジェクトを返す |
<FORM NAME="F1"> <INPUT TYPE="HIDDEN" NAME="h" VALUE="見えません"> </FORM> <SCRIPT TYPE="text/JavaScript"> <!-- var F1 = document.F1.elements[0].form; document.write( "Form Name: ", F1.name, "<BR>" ); var F2 = document.F1; for( i =0 ; i < F2.elements.length ; i++ ) { document.write( "Type[", i, "] : ", F2.elements[i].type, "<BR>" ); } for( i =0 ; i < F2.elements.length ; i++ ) { document.write( "Value[", i, "] : ", F2.elements[i].value, "<BR>" ); } document.write( "Length : ", F2.elements.length ); //--> </SCRIPT> |