我可以有< SCRIPT>里面的标签< TABLE> ;? [英] Can I have <SCRIPT> tag inside <TABLE>?
问题描述
我需要在表格中添加一个标签,因为PHP会在那里写入一个代码,将代码添加到早期创建的Javascript数组中。然而,我得到一个验证错误(4.01严格)。
有没有什么办法可以做到这一点,还是仅仅禁止像这样的脚本:
< TABLE>
< TR>
< SCRIPT>< / SCRIPT>
< TD>
< / TD>
< / TR>
< / TABLE>
(这可能更好吗?):
<表>
< TR>
< TD>
< SCRIPT>< / SCRIPT>
< / TD>
< / TR>
< / TABLE>
更改文档类型?你认为什么?
SCRIPT
。 org / TR / html4 / struct / tables.html#edef-TRrel =noreferrer> TR
作为 TR
被定义为(TH | TD)+
:
<!ELEMENT TR - O(TH | TD)+ - 表格行 - >
这意味着一个或多个元素 TH
或 TD
。
但是 SCRIPT
code> TD 。请参阅 TD $ c的定义$ c $>
<!ELEMENT(TH | TD) - O(%flow;)* - 表格标题单元,表格数据单元 - >
凡 parameter entity flow 定义为:
<!ENTITY%flow%block; |%inline;>
和 inline 定义为:
<!ENTITY%inline#PCDATA |%fontstyle; |%phrase; |%special; |%formctrl;>
和 special 定义为:
<!ENTITY%special
A | IMG | OBJECT | BR | SCRIPT | MAP | Q | SUB | SUP | SPAN | BDO>
I got to have a tag inside a table because PHP writes a code there that adds stuff to an earlier created Javascript array. However, I get a validation error (4.01 strict).
Is there any way I can do this or is it simply forbidden to keep a script like this:
<TABLE>
<TR>
<SCRIPT></SCRIPT>
<TD>
</TD>
</TR>
</TABLE>
(is this better maybe?):
<TABLE>
<TR>
<TD>
<SCRIPT></SCRIPT>
</TD>
</TR>
</TABLE>
Change doctype? What do you think?
SCRIPT
is not allowed in TR
as the content model of TR
is defined as (TH|TD)+
:
<!ELEMENT TR - O (TH|TD)+ -- table row -->
That means one or more elements of TH
or TD
.
But SCRIPT
is allowed in TD
. See the definition of TD
:
<!ELEMENT (TH|TD) - O (%flow;)* -- table header cell, table data cell-->
Where the parameter entity flow is defined as:
<!ENTITY % flow "%block; | %inline;">
And inline is defined as:
<!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; | %formctrl;">
And special is define as:
<!ENTITY % special
"A | IMG | OBJECT | BR | SCRIPT | MAP | Q | SUB | SUP | SPAN | BDO">
这篇关于我可以有< SCRIPT>里面的标签< TABLE> ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!