隐藏/显示DHTML [英] Hide/reveal DHTML

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

问题描述

我需要使用javascript隐藏/显示网页的某些部分。我想我可以使用< span>来赚取b $ b。标签,但我已经离开它一段时间了,

不记得了。任何指针,例子?

解决方案

2004年11月23日星期二16:34:03 -0600,ATS

< ; AF ************************** @ comcast.net>写道:

我需要使用javascript隐藏/显示网页的某些部分。我想我可以使用< span>标签,但我已经离开它一段时间
并且不记得了。任何指针,例子?




这已被问过很多次*。请查看群组档案:


< URL:http://groups.google.com/groups?q = group:comp.lang.javascript + show + hide + elem ent +%7C + div +%7C + layer& scoring = d>


虽然您找到的帖子主要适用于DIV和其他块级

元素,原则可以应用于任何元素。


我想添加的唯一注释可能不存在于所有

线程中最初不应该使用CSS隐藏内容。如果

脚本无法执行(无论出于何种原因),用户将无法查看内容。相反,当文档加载时,用脚本

隐藏相应的内容。


祝你好运,

Mike


-

Michael Winter

替换.invalid与.uk通过电子邮件回复。




" ATS" < AF ************************** @ comcast.net>在留言中写道

news:ke ******************** @ comcast.com ...

I需要使用javascript隐藏/显示网页的某些部分。我想我可以使用< span>来做标签,但我已经离开它一段时间了,
不记得了。任何指针,例子?



这是我最近在团队的帮助下做的一个例子

http://www.sunnysideup.co.nz/clients...s/listing.html


请注意< DIV ID = bas>是关键的Div,任何ID在

Bas(代表基数)div内的div都将被隐藏,而< A HREFs>在菜单中允许

用户查看它们。


- Nicolaas


" Michael冬季"写了

这个内容最初不应该用CSS隐藏。如果
脚本无法执行(无论出于何种原因),用户将无法查看内容。相反,在文档加载时用
脚本隐藏适当的内容。




这是一个困难的困境。你的观点是非常有效的,我们应该总是意识到javascript没有出现或启用,但如果有一个

的东西使得网站在我看来看起来不专业,这是页面,

分崩离析并在加载后重新组装,特别是当隐藏

内容时。一般的计算机用户感觉还不够确定



我总是试图设计,以便页面在它被请求的时候保持稳定

,并在*加载期间进行任何操作*。如果用户没有

javascript,他就会错过很多乐趣。

-

Ivo


I need to hide/reveal parts of a web page using javascript. I think I can
do with using the <span> tag, but I''ve been away from it for a while and
don''t remember. Any pointers, examples?

解决方案

On Tue, 23 Nov 2004 16:34:03 -0600, ATS
<af**************************@comcast.net> wrote:

I need to hide/reveal parts of a web page using javascript. I think I
can do with using the <span> tag, but I''ve been away from it for a while
and don''t remember. Any pointers, examples?



This has been asked *many* times. Please look through the group archives:

<URL:http://groups.google.com/groups?q=group:comp.lang.javascript+show+hide+elem ent+%7C+div+%7C+layer&scoring=d>

Though the posts you find will apply mainly to DIVs and other block-level
elements, the principle can be applied to any element.

The only comment I would like to add that may not be present in all of the
threads is that content should not be hidden initially with CSS. If the
script cannot execute (for whatever reason), the user will not be able to
view the content. Instead, hide the appropriate content with the script
when the document loads.

Good luck,
Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.



"ATS" <af**************************@comcast.net> wrote in message
news:ke********************@comcast.com...

I need to hide/reveal parts of a web page using javascript. I think I can
do with using the <span> tag, but I''ve been away from it for a while and
don''t remember. Any pointers, examples?


Here is a recent example that I made with help from the group

http://www.sunnysideup.co.nz/clients...s/listing.html

Note that the <DIV ID=bas> is the crucial Div, any divs with IDs within the
Bas (stands for base) div will be hidden and the <A HREFs> in the menu allow
the user to see them.

- Nicolaas


"Michael Winter" wrote

that content should not be hidden initially with CSS. If the
script cannot execute (for whatever reason), the user will not be able
to view the content. Instead, hide the appropriate content with the
script when the document loads.



This is a difficult dilemma. Your point is very valid, we should always be
conscious of javascript not being present or enabled, but if there is one
thing that makes a site look unprofessional in my view, it is pages that
fall apart and reassemble themselves after loading, especially when hidden
content is involved. The average computer user is feeling uncertain enough
already.
I always try to design so that a page stands solid the moment it is
requested, and do any manipulations *during* load. If the user has no
javascript, he will be missing out on a lot of fun anyway.
--
Ivo


这篇关于隐藏/显示DHTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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