?在HTML文档中存储内部信息(例如内部标记) [英] ? Storing Internal Information In An HTML Document (eg Inside Tags)
问题描述
我需要一种方法将我的网站划分为部门。我想要的是
能够允许一些JavaScript函数以不同的方式执行
当前页面被分配到哪个部门。
例如,如果用户点击页面中的链接,该链接将触发
a JS功能,用于检查页面所在的部门并执行某些操作。
如果用户点击分配给不同的
部门的其他页面上的该链接,该功能会执行其他操作。
我尝试做什么是在页面
中放入一个不可见的DIV元素,其中DIV的ID属性是_dept_。无论部门是什么,NAME属性都是
。 JS函数查找_dept_元素
并读取它的name属性。这个问题是,当我尝试验证页面时,我会在name属性上出错(不是在XHTML
Strict)。
我该怎么办?
谢谢。
-
Alec S.
alec< @> synetech<。> cjb<。> net
>我试图做的是在页面中放入一个不可见的DIV元素,其中DIV的ID属性是_dept_。无论部门是什么,NAME属性都是
。 JS函数查找_dept_元素
并读取它的name属性。这个问题是,当我尝试验证页面时,我在name属性上出错(不是在XHTML中严格)。
我该怎么办? / blockquote>
尝试使用id属性而不是名称。
Alec S.写道:我试图做的是在页面中放入一个不可见的DIV元素
,其中DIV的ID属性是_dept_。无论部门是什么,NAME属性都是
。 JS函数查找_dept_元素
并读取它的name属性。这个问题是,当我尝试验证页面时,我在name属性上出错(不是在XHTML中
滥用其他属性 - 说,标题 - 为此目的。或者,甚至
更好,停止尝试使用这种破碎的技术。
" Leif K -Brooks"< eu ***** @ ecritters.biz>在留言中写道
新闻:36 ************* @ individual.net ...或者,更好的是,停止尝试使用这种破碎的技术。
如果您建议采用其他方法,我会这样做。究竟做什么
你的意思是破碎的技术?
-
Alec S.
alec< @> synetech<。> cjb<。> net
Hi,
I need a way of dividing up my site into "departments". What I want is
to be able to allow some JavaScript functions to perform differently based
on what department the current page is assigned to.
For example, if the user clicks on a link in a page, the link fires off
a JS function that checks what department the page is in and does something.
If the user clicks on that link on a different page assigned to a different
department, the function does something else.
What I tried to do was to put in an invisible DIV element in the pages
where the ID attribute of the DIV is "_dept_" and the NAME attribute is
whatever the department is. The JS function looks for the _dept_ element
and reads it''s name attribute. The problem with this is that when I try to
validate the page I get an error on the name attribute (not in XHTML
Strict).
What can I do?
thanks.
--
Alec S.
alec <@> synetech <.> cjb <.> net解决方案> What I tried to do was to put in an invisible DIV element in the pageswhere the ID attribute of the DIV is "_dept_" and the NAME attribute is
whatever the department is. The JS function looks for the _dept_ element
and reads it''s name attribute. The problem with this is that when I try to
validate the page I get an error on the name attribute (not in XHTML
Strict).
What can I do?
Try using the id attribute instead of name.
Alec S. wrote:What I tried to do was to put in an invisible DIV element in the pages
where the ID attribute of the DIV is "_dept_" and the NAME attribute is
whatever the department is. The JS function looks for the _dept_ element
and reads it''s name attribute. The problem with this is that when I try to
validate the page I get an error on the name attribute (not in XHTML
Abuse another attribute -- say, title -- for this purpose. Or, even
better, stop trying to use such a broken technique.
"Leif K-Brooks" <eu*****@ecritters.biz> wrote in message
news:36*************@individual.net...Or, even better, stop trying to use such a broken technique.
I would if you had suggested another way to do this. What exactly do
you mean by a "broken technique"?
--
Alec S.
alec <@> synetech <.> cjb <.> net
这篇关于?在HTML文档中存储内部信息(例如内部标记)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!