我可以在其他表单标签中嵌入表单标签吗? [英] Can I nest form tags in other form tags?

查看:115
本文介绍了我可以在其他表单标签中嵌入表单标签吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在< form> 标签内放置< form> 标签吗?



例如:

 < form> 
< form>
< / form>
< / form>


解决方案

不,嵌套表单被禁止。






这表示在 HTML 4.01 DTD中:

 <!ELEMENT FORM  -   - (%block; | SCRIPT)+  - (FORM) -  interactive form  - > 

- http://www.w3.org/TR/html4/interact/forms.html#h-17.3



这意味着一个FORM有一个强制开始标记和强制结束标记,并且可以包含%block或SCRIPT中的任何内容,除了其他FORM。




XML DTD不像SGML DTD那样具有表达性,因此在 XHTML 中,此规则仅在规范:


表单不得包含其他表单元素。

- http://www.w3.org/TR/xhtml1/#禁止






HTML 5 不是SGML应用程序,有一个正式的机器可读的语言描述。它还在文本中表达了这一规则:


内容模型: ,但没有表单元素的后代。


- http://www.w3.org/TR/html5/forms.html#the-form-element


Can I put a <form> tag inside another <form> tag?

For example:

<form>
  <form>
  </form>
</form>

解决方案

No, nested forms are forbidden.


This is expressed in the HTML 4.01 DTDs as:

<!ELEMENT FORM - - (%block;|SCRIPT)+ -(FORM) -- interactive form -->

http://www.w3.org/TR/html4/interact/forms.html#h-17.3

This means A FORM has a mandatory start tag, mandatory end tag and can contain anything in %block or SCRIPT, except other FORMs.


XML DTDs aren't as expressive as SGML DTDs so in XHTML this rule is specified only in the human readable text of the specification:

form must not contain other form elements.

http://www.w3.org/TR/xhtml1/#prohibitions


HTML 5 isn't an SGML application and doesn't have an official machine readable description of the language. It also expresses this rule in text:

Content model:

Flow content, but with no form element descendants.

http://www.w3.org/TR/html5/forms.html#the-form-element

这篇关于我可以在其他表单标签中嵌入表单标签吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆