DIV块内的FORM的一部分 [英] part of a FORM inside DIV block
问题描述
我有一块看起来像这样的HTML代码
< FORM name = myform>
< INPUT type = text name = firstname>
< DIV id = mydiv>
< INPUT type = text name = address>
< / DIV>
< / FORM>
i可以使用document.myform.firstname访问firstname字段
但是如何引用地址字段它位于DIV块内。
也不是document.myform.mydiv.address既不是
document.myform.mydiv.document.address工作
任何想法?这真是踢我的屁股。
Michal Mieszkowski hu kiteb:
我有一个看起来像这样的HTML代码块
< FORM name = myform>
< INPUT type = text name = firstname>
< DIV id = mydiv>
< INPUT type = text name = address>
< / DIV>
< / FORM>
我可以使用document.myform.firstname
也不是document.myform.mydiv.address
document.myform.mydiv.document.address的工作原理
您是否尝试过document.myform.address?
-
-
Fabian
经常长时间访问我的网站!
http://www.lajzar.co.uk
ju **** @ interia.pl (Michal Mieszkowski)写道:
< FORM name = myform>
< ; INPUT type = text name = firstname>
< DIV id = mydiv>
< INPUT type = text name = address>
< / DIV>
< / FORM>
但是如何引用DIV块内的地址字段。
也不是document.myform.mydiv.address
document.myform.mydiv.document.address works
这不是寻址的工作方式。实际上,document.myform是指document.myform。本身
不是任何标准的一部分。
获取表格的适当和标准[1]认可的方式
控制是:
document.forms [''myform'']。elements [''address'']
div与表单和表单之间的关系无关控制。
建议使用id而不是名称而不是名称在表格上。
/ L
[1]嗯,按照租约W3C推荐认可。
-
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML死亡颜色:< URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
''没有判断的信仰只会降低精神神圣。 '
Lasse Reichstein Nielsen ecrit:
并且建议使用id而不是名称而不是名称在表格上。
是的!
但是......
我的NC4.5不能使用它!
所以:
document.forms [0] .elements [2] .value
无处不在
-
***************************** ********************* ************
$ b $bStéphaneMORIAUX:mailto:st *** ******************@wanadoo.fr
Aide aux Pages Perso(图片& couleurs,formulaire,CHP,JS)
http://perso.wanadoo.fr/stephane.moriaux/internet/
*************************************** *********** ************
i have a block of html code looking like this
<FORM name=myform>
<INPUT type=text name=firstname>
<DIV id=mydiv>
<INPUT type=text name=address>
</DIV>
</FORM>
i can access firstname field with document.myform.firstname
but how to reference to address field which is inside a DIV block.
nor document.myform.mydiv.address neither
document.myform.mydiv.document.address works
any ideas? this is realy kickin'' my ass.
Michal Mieszkowski hu kiteb:
i have a block of html code looking like this
<FORM name=myform>
<INPUT type=text name=firstname>
<DIV id=mydiv>
<INPUT type=text name=address>
</DIV>
</FORM>
i can access firstname field with document.myform.firstname
but how to reference to address field which is inside a DIV block.
nor document.myform.mydiv.address neither
document.myform.mydiv.document.address works
Have you tried document.myform.address yet?
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk
ju****@interia.pl (Michal Mieszkowski) writes:
<FORM name=myform>
<INPUT type=text name=firstname>
<DIV id=mydiv>
<INPUT type=text name=address>
</DIV>
</FORM> but how to reference to address field which is inside a DIV block.
nor document.myform.mydiv.address neither
document.myform.mydiv.document.address works
That''s not how addressing works. In fact, "document.myform" itself
isn''t part of any standard.
The appropriate and standards[1] sanctioned way to access a form
control is:
document.forms[''myform''].elements[''address'']
The div is irrelevant to the relation between form and form control.
And it is recommended to use "id" instead of "name" on the form.
/L
[1] Well, at leaset "W3C Recommendation" sanctioned.
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
''Faith without judgement merely degrades the spirit divine.''
Lasse Reichstein Nielsen a ecrit :
And it is recommended to use "id" instead of "name" on the form.
Yes !
But ...
my NC4.5 can''t use it !
so :
document.forms[0].elements[2].value
would work everywhere
--
************************************************** ************
Stéphane MORIAUX : mailto:st*********************@wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephane.moriaux/internet/
************************************************** ************
这篇关于DIV块内的FORM的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!