自定义标签和元素 [英] custom tags and elements

查看:107
本文介绍了自定义标签和元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我想加入额外的隐藏字样生成的HTML页面中的信息

可以被javascript函数使用。


我意识到大多数浏览器似乎忽略了任何标签和属性>
不明白,但据我所知,标准不允许我

组成我自己的标签或属性,因为它们将无法通过验证。


是否有任何可用于此目的的标准元素名称,即

通过验证但从不产生任何输出(理想情况下允许嵌套

要正常渲染的元素)


安迪

Hi,

I would like to include extra "hidden" information in a generated HTML page
that can be used by javascript functions.

I realise that most browsers seem to ignore any tags and attributes they
don''t understand, but from what I can tell the standards do not allow me to
make up my own tags or attributes as they will fail validation.

is there any standard element name that can be used for such a purpose i.e.
passes validation but never produces any output (and ideally allows nested
elements to be rendered normally too)

Andy


推荐答案

安迪Fish写道:
Andy Fish wrote:

我想包括额外的隐藏生成的HTML页面中的信息

可以被javascript函数使用。


我意识到大多数浏览器似乎忽略了任何标签和属性>
不明白,但据我所知,标准不允许我

组成我自己的标签或属性,因为它们将无法通过验证。


是否有任何可用于此目的的标准元素名称,即

通过验证但从不产生任何输出(理想情况下允许嵌套

正常渲染的元素)
I would like to include extra "hidden" information in a generated HTML page
that can be used by javascript functions.

I realise that most browsers seem to ignore any tags and attributes they
don''t understand, but from what I can tell the standards do not allow me to
make up my own tags or attributes as they will fail validation.

is there any standard element name that can be used for such a purpose i.e.
passes validation but never produces any output (and ideally allows nested
elements to be rendered normally too)



如果你想将额外的数据放入网页供javascript使用,为什么

没有把它放在一个SCRIPT元素中,可能是一个由
数组和对象文字组成的结构(因为任何可以用

标记树表示的结构也可以用这样的表格。


Richard。

If you want to put extra data into a web page for use by javascript why
not put it inside a SCRIPT element, probably in a structure made up of
Array and Object literals (as anything that can be represented with a
mark-up tree can also be represented in such a form).

Richard.


2006-12-05,Andy Fish& lt; aj **** @ blueyonder.co.ukwrote:
On 2006-12-05, Andy Fish <aj****@blueyonder.co.ukwrote:




我想加入额外的"隐藏"生成的HTML页面中的信息

可以被javascript函数使用。


我意识到大多数浏览器似乎忽略了任何标签和属性>
不明白,但据我所知,标准不允许我

组成我自己的标签或属性,因为它们将无法通过验证。


是否有任何可用于此目的的标准元素名称,即

通过验证但从不产生任何输出(理想情况下允许嵌套

通常也要渲染的元素)
Hi,

I would like to include extra "hidden" information in a generated HTML page
that can be used by javascript functions.

I realise that most browsers seem to ignore any tags and attributes they
don''t understand, but from what I can tell the standards do not allow me to
make up my own tags or attributes as they will fail validation.

is there any standard element name that can be used for such a purpose i.e.
passes validation but never produces any output (and ideally allows nested
elements to be rendered normally too)



你可以将div与某些类名一起使用并使用CSS来

set display:none对于那个班级的div。


div.data

{

display:none;

}


< div class =" data">

....

< / div>

You can just use div in conjunction with some class name and use CSS to
set display: none for divs of that class.

div.data
{
display: none;
}

<div class="data">
....
</div>


" Andy Fish" < aj **** @ blueyonder.co.ukwrote:
"Andy Fish" <aj****@blueyonder.co.ukwrote:

>我想加入额外的隐藏字样生成的HTML页面中的信息可以被javascript函数使用。

我意识到大多数浏览器似乎忽略了他们不了解的任何标签和属性,但是从我可以告诉标准不允许我构建我自己的标签或属性,因为它们将无法验证。

是否有任何标准元素名称可用于这样的目的即
通过验证,但从不产生任何输出(理想情况下也允许嵌套的
元素正常渲染)
>I would like to include extra "hidden" information in a generated HTML page
that can be used by javascript functions.

I realise that most browsers seem to ignore any tags and attributes they
don''t understand, but from what I can tell the standards do not allow me to
make up my own tags or attributes as they will fail validation.

is there any standard element name that can be used for such a purpose i.e.
passes validation but never produces any output (and ideally allows nested
elements to be rendered normally too)



你是什么实际上是在尝试吗?


-

Spartanicus

What is it that you are actually trying to do?

--
Spartanicus


这篇关于自定义标签和元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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