根据ID或标题隐藏DIV标签? [英] Hiding DIV tags based on id or title?
问题描述
我在HTML页面上有很多DIV标签。我想将其中一些分组
,以便我可以在需要时立即将它们全部隐藏起来。什么是好的
这样做的方法?我希望这与至少IE 5兼容。将
分配给同一组中的所有DIV标签是个好主意
" title"属性?
这就是我想要做的,但我不确定它是否是正确的
方法,我不知道怎么做使用javascript设置样式:
< div title =" groupA"> hello world< / div>
< div title =" groupB" >来自b组< / div>
然后使用javascript设置此样式:
div [title =''groupA'']
{
显示:无
}
如果这是正确的方法,并且与IE说是兼容5或6,
会有人告诉我如何在javascript中执行此操作吗?
Kourosh说以下是5/13/2006 3:34 PM:我在HTML页面上有很多DIV标签。我想将其中一些组合起来
以便我可以在需要时立即将它们全部隐藏起来。这样做的好方法是什么?
为他们分配一个类,然后更改该类的显示.class
我希望这与至少IE 5兼容。
为什么?但是,实现这一目标相当容易。
将同一组中的所有DIV标签分配为相同的标题是不是一个好主意。属性?
DIV标签有标题属性吗?
这就是我想做的,但我不确定它是不是正确的
方法,我不知道如何用javascript设置样式:
< div title =" groupA"> hello world< / div>
< ; div title =" groupB"> from group b< / div>
< div class =" groupA"> hello world< / div>
< div class =" groupB"> from group b< / div>
然后使用javascript设置此样式:
div [title =''groupA'']
{
显示:无
}
搜索档案。 动态改变可见性
如果这是正确的方法,并且与IE 5或6兼容,
有人会告诉我如何在javascript中执行此操作吗?
我可以,但我不会。搜索档案。
-
兰迪
comp.lang.javascript常见问题 - http://jibbering.com/faq &新闻组每周
Javascript最佳实践 - http://www.JavascriptToolbox .com / bestpractices /
非常感谢信息:)我会稍后搜索/工作并发布
$ b如果有任何问题,请回b $
欢呼
"兰迪韦伯 <您好************ @ aol.com>写道:Kourosh在5/13/2006 3:34 PM说了以下内容:我在HTML页面上有很多DIV标签。我想将其中一些组合起来
以便我可以在需要时立即将它们全部隐藏起来。什么是好的
方法呢?
为他们分配一个类,然后改变它的显示.class
我希望这与至少IE 5兼容。
为什么?但是,这很容易实现。
将同一组中的所有DIV标签分配为相同的标题是不是一个好主意;属性?
DIV标签有标题属性吗?
这就是我想要做的,但我不确定它是不是是正确的
方法,我不知道如何用javascript设置样式:
< div title =" groupA"> hello world< / div> ;
< div title =" groupB">来自b组< / div>
< div class =" groupA"> hello world< / div>
< div class =" groupB"> from b< / div>
然后使用javascript设置此样式:
div [title =''groupA'']
{
显示:无
}
搜索档案。 动态更改可见性
如果这是正确的方法,并且与IE 5或6兼容,
有人会告诉我如何在javascript中执行此操作吗?
我可以,但我不会。搜索档案。
假装破坏!如果你不准备帮助这个家伙,你为什么难以回应呢?
-
altheim
I have a lot of DIV tags on an HTML page. I want to group some of them
so that I can hide them all together at once if needed. What''s a good
way to do this? I want this to be compatible with at least IE 5. Would
it be a good idea to assign all DIV tags in the same group the same
"title" attribute?
This is what I want to do, but I''m not sure if it''s the correct
approach, and I''m not sure how to set the style with javascript either:
<div title="groupA">hello world</div>
<div title="groupB">from group b</div>
then with javascript set this style:
div[title=''groupA'']
{
display:none
}
If this is the right approach, and is compatible with say IE 5 or 6,
would someone tell me how to do it in javascript?
Kourosh said the following on 5/13/2006 3:34 PM:I have a lot of DIV tags on an HTML page. I want to group some of them
so that I can hide them all together at once if needed. What''s a good
way to do this?
Assign them a class and then change the display of that .class
I want this to be compatible with at least IE 5.
Why? But, it is rather easy to accomplish that.
Would it be a good idea to assign all DIV tags in the same group the same
"title" attribute?
DIV tags have title attributes?
This is what I want to do, but I''m not sure if it''s the correct
approach, and I''m not sure how to set the style with javascript either:
<div title="groupA">hello world</div>
<div title="groupB">from group b</div>
<div class="groupA">hello world</div>
<div class="groupB">from group b</div>
then with javascript set this style:
div[title=''groupA'']
{
display:none
}
Search the archives. "Dynamically change visibility"
If this is the right approach, and is compatible with say IE 5 or 6,
would someone tell me how to do it in javascript?
I could, but I won''t. Search the archives.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
thanks a lot for the info :) I''ll search/work on this later and post
back if there are any problems
cheers
"Randy Webb" <Hi************@aol.com> wrote:Kourosh said the following on 5/13/2006 3:34 PM:I have a lot of DIV tags on an HTML page. I want to group some of them
so that I can hide them all together at once if needed. What''s a good
way to do this?
Assign them a class and then change the display of that .classI want this to be compatible with at least IE 5.
Why? But, it is rather easy to accomplish that.Would it be a good idea to assign all DIV tags in the same group the same
"title" attribute?
DIV tags have title attributes?This is what I want to do, but I''m not sure if it''s the correct
approach, and I''m not sure how to set the style with javascript either:
<div title="groupA">hello world</div>
<div title="groupB">from group b</div>
<div class="groupA">hello world</div>
<div class="groupB">from group b</div>then with javascript set this style:
div[title=''groupA'']
{
display:none
}
Search the archives. "Dynamically change visibility"If this is the right approach, and is compatible with say IE 5 or 6,
would someone tell me how to do it in javascript?
I could, but I won''t. Search the archives.
Sanctimonious prick! If you are not prepared to help
the guy, why did you trouble to respond?
--
altheim
这篇关于根据ID或标题隐藏DIV标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!