表内表格 [英] form inside table

查看:67
本文介绍了表内表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么错了?

<table>
  <form>
    <tr><td>something something</td/>
  </form>
</table>

我说的是表格标签在表格标签中的位置.

I'm talking about position of form tags inside table tags.

推荐答案

来自 DTD :

<!ELEMENT TABLE - -
     (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)>
<!ELEMENT CAPTION  - - (%inline;)*     -- table caption -->
<!ELEMENT THEAD    - O (TR)+           -- table header -->
<!ELEMENT TFOOT    - O (TR)+           -- table footer -->
<!ELEMENT TBODY    O O (TR)+           -- table body -->
<!ELEMENT COLGROUP - O (COL)*          -- table column group -->
<!ELEMENT COL      - O EMPTY           -- table column -->
<!ELEMENT TR       - O (TH|TD)+        -- table row -->
<!ELEMENT (TH|TD)  - O (%flow;)*       -- table header cell, table data cell-->

这些是您可以在table元素内拥有的唯一元素(在本例中为HTML 4,但是您检查了相同类型的文档的其他版本,并且更改不多).

These are the only elements you can have inside a table element (in HTML 4 in this case, but you check the same kind of document for other versions, and it's not changed much).

另一方面,form元素可以包含任何其他块级元素(其他形式除外):

On the other hand, a form element can contain any other block-level element (except other forms):

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

td元素可以包含任何"flow"元素(如第一个代码块所示),并且"flow"包括块级元素:

And the td element can contain any "flow" element (as seen in the first code block), and "flow" include block level elements:

<!ENTITY % flow "%block; | %inline;">

因此,您可以将<form>标签放在整个表格周围或一个表格单元格内.

So you can put your <form> tags either around the entire table or inside one table cell.

这篇关于表内表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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