473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Hiding CSS class from Netscape 4.x

I'm trying to do a show/hide of several elements on a page and can't
get it working in Netscape 4.x. All other Windows browsers are
working.

My elements all have the same class name. <div
class="myClassName">stuff</div>
I cannot use ID because I don't know how many will appear as they are
dynamic recordsets. Netscape seems to work OK with IDs but not CSS
classes.

For Netscape 4.x I have coded in my javascript:
document.myClassName.visibility = "hide"; to hide it and
document.myClassName.visibility = "show"; to show it.

My CSS for this function is:

<style type="text/css">
..myClassName {visibility:hidden;}
</style>

When I use the toggle I get this error: document.myClassName has no
properties.

Any suggestions? Right now we are considering having standards-aware
browsers use client-side show/hide ( via
document.getElementsByTagName() ) and forcing Netscape 4.x to reload
the page, but would prefer to do it all in the browser.
Jul 20 '05 #1
6 1941
tr********@excite.com (TravelMan) wrote in
news:ca**************************@posting.google.c om:
I'm trying to do a show/hide of several elements on a page and
can't get it working in Netscape 4.x. All other Windows browsers
are working.


Why not hide all CSS from Netscape 4.x and provide Structural Markup?
You can't support buggy browsers for ever...

How to hide CSS from buggy browsers
http://w3development.de/css/hide_css_from_browsers/

--
Kayode Okeyode
http://www.kayodeok.co.uk/weblog/
Jul 20 '05 #2
TravelMan wrote:
I'm trying to do a show/hide of several elements on a page and can't
get it working in Netscape 4.x. All other Windows browsers are
working.
Sorry, but I really doubt that the below is working with *any* user agent.
For Netscape 4.x I have coded in my javascript:
document.myClassName.visibility = "hide"; to hide it and
document.myClassName.visibility = "show"; to show it.

My CSS for this function is:

<style type="text/css">
..myClassName {visibility:hidden;}
Is the `..' a typo? If not, remove one dot.
</style>

When I use the toggle I get this error: document.myClassName has no
properties.


You cannot reference CSS classes like objects. Instead, iterate
through the collection of DIV elements (use document.getElementsByName,
document.getElementsByTagName or document.layers, depending on the DOM[1])
and change the `className' property of each element to the name of a
CSS class where the `visibility' property has the value of `show'.
F'up2 cljs

PointedEars
___________
[1] Possibly you find http://pointedears.de.vu/scripts/dhtml.js useful
in this regard.

Jul 20 '05 #3
Thomas 'PointedEars' Lahn <Po*********@web.de> wrote in message news:<3F**************@PointedEars.de>...
TravelMan wrote:
I'm trying to do a show/hide of several elements on a page and can't
get it working in Netscape 4.x. All other Windows browsers are
working.


Sorry, but I really doubt that the below is working with *any* user agent.
For Netscape 4.x I have coded in my javascript:
document.myClassName.visibility = "hide"; to hide it and
document.myClassName.visibility = "show"; to show it.

My CSS for this function is:

<style type="text/css">
..myClassName {visibility:hidden;}


Is the `..' a typo? If not, remove one dot.
</style>

When I use the toggle I get this error: document.myClassName has no
properties.


You cannot reference CSS classes like objects. Instead, iterate
through the collection of DIV elements (use document.getElementsByName,
document.getElementsByTagName or document.layers, depending on the DOM[1])
and change the `className' property of each element to the name of a
CSS class where the `visibility' property has the value of `show'.
F'up2 cljs

PointedEars
___________
[1] Possibly you find http://pointedears.de.vu/scripts/dhtml.js useful
in this regard.


How do you get a handle on the className for a DIV when
getElementsByTagName doesn't work in NN4.x? Is there another way to
get the className for a DIV or a layer?
Jul 20 '05 #4
TravelMan wrote:
Thomas 'PointedEars' Lahn <Po*********@web.de> wrote in message
news:<3F**************@PointedEars.de>...
It is called attribution _line_.
TravelMan wrote:
[...]
> <style type="text/css">
> ..myClassName {visibility:hidden;}


Is the `..' a typo? If not, remove one dot.
> </style>
>
> When I use the toggle I get this error: document.myClassName has no
> properties.


You cannot reference CSS classes like objects. Instead, iterate
through the collection of DIV elements (use document.getElementsByName,
document.getElementsByTagName or document.layers, depending on the DOM[1]) ^^^^^^^^^^^^^^^ and change the `className' property of each element to the name of a
CSS class where the `visibility' property has the value of `show'.
[...]


How do you get a handle on the className for a DIV when
getElementsByTagName doesn't work in NN4.x?


See above. The document.layers[...] collection allows for referencing
positioned layers.
Is there another way to get the className for a DIV or a layer?


Sorry, NS4-DOM seems not to provide a className property,
so referenceToLayer.visibility is the only way.
(again!) followup-to comp.lang.javascript

PointedEars

P.S.: Please don't quote what you are not referring to.

Jul 20 '05 #5
Can you recommend any good books on the DOM and DOM scripting? I'm new
to using that and already am impressed by the power of what it offers.
Thanks.
Jul 20 '05 #6
TravelMan wrote:
Can you recommend any good books on the DOM and DOM scripting?
follow from here: http://www.w3.org/DOM/
I'm new
to using that and already am impressed by the power of what it offers.


just be sure you ensure your pages work in UAs without script support e.g.
googlebot.

--
William Tasso - http://WilliamTasso.com
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Code Monkee | last post by:
How can the toolbar and menubar be hidden in IE? When opening the window via javascript I can specify 'toolbar=no,menubar=no', which works fine. However if the window already exists how can I...
8
by: TravelMan | last post by:
I'm trying to do a show/hide of several elements on a page and can't get it working in Netscape 4.x. All other Windows browsers are working. My elements all have the same class name. <div...
11
by: Lorenzo Villari | last post by:
I premise I don't know C++ well but... I wondered what is this data hiding thing... I mean, if I can look at the header (and i need it beacuse of the class), then what's hidden? Can someone give...
1
by: comp.lang.javascript | last post by:
Using IE5.5+, is it possible to hide options in a select? The following doesn't work: <HTML> <HEAD> <STYLE> SELECT OPTION.orgA{ display:none } .orgB{ display:inline } .orgC{ display:none }
9
by: middletree | last post by:
I'm doing an ASP-built Intranet app, and am having trouble with a bit of code on the menu I am using. I got it from some free site, but I tried emailing the person whose email address is in the...
17
by: Bob Weiner | last post by:
What is the purpose of hiding intead of overriding a method? I have googled the question but haven't found anything that makes any sense of it. In the code below, the only difference is that...
9
by: bob | last post by:
Hi, I know there exists a good reason why the designers of c++ decided that function hiding should exist. But I don't know why. Can anybody provide a good reason/example of a case where function...
3
by: Nicolas Castagne | last post by:
Hi all, I have been wondering for a while why function hiding (in a derived class) exists in C++, e.g. why when writing class Base { void foo( int ) {} }; class Derived: public Base { void...
2
by: subramanian100in | last post by:
Is my following understanding correct ? Data abstraction means providing the interface - that is, the set of functions that can be called by the user of a class. Information hiding means...
162
by: Sh4wn | last post by:
Hi, first, python is one of my fav languages, and i'll definitely keep developing with it. But, there's 1 one thing what I -really- miss: data hiding. I know member vars are private when you...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.