473,761 Members | 8,011 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="myClassN ame">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.myClas sName.visibilit y = "hide"; to hide it and
document.myClas sName.visibilit y = "show"; to show it.

My CSS for this function is:

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

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

Any suggestions? Right now we are considering having standards-aware
browsers use client-side show/hide ( via
document.getEle mentsByTagName( ) ) and forcing Netscape 4.x to reload
the page, but would prefer to do it all in the browser.
Jul 20 '05 #1
8 2429
tr********@exci te.com (TravelMan) wrote in
news:ca******** *************** ***@posting.goo gle.com:
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.myClas sName.visibilit y = "hide"; to hide it and
document.myClas sName.visibilit y = "show"; to show it.

My CSS for this function is:

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

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


You cannot reference CSS classes like objects. Instead, iterate
through the collection of DIV elements (use document.getEle mentsByName,
document.getEle mentsByTagName 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
> and change the `className' property of each element to the name of a
CSS class where the `visibility' property has the value of `show'.


Why is that better than using JavaScript to change the CSS property?
I'm just curious because I saw that method elsewhere [on the MSDN] and found
it quite interesting. Is it really better? You're still using JavaScript
either way.

Thanks,
Nicko.
Jul 20 '05 #4


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.

My elements all have the same class name. <div
class="myClassN ame">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.myClas sName.visibilit y = "hide"; to hide it and
document.myClas sName.visibilit y = "show"; to show it.

My CSS for this function is:

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

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

Any suggestions? Right now we are considering having standards-aware
browsers use client-side show/hide ( via
document.getEle mentsByTagName( ) ) and forcing Netscape 4.x to reload
the page, but would prefer to do it all in the browser.


Are those <div> elements positioned absolutely or statically with CSS?
If not forget about manipulating them with script as NN4 only makes
positioned elements available in its DOM.
If the <div>s are positioned then they should appear in
document.layers
and you can loop through document.layers
for (var i = 0; i < document.layers .length; i++)
document.layers[i].visibility = 'hide';
However if you wanted to check the class attribute of such a layer you
can't so you need to use other means to identify that a layer belongs to
a class, some way is to use an id attribute of the form
<div id="myClass01" >
then you can check
document.layers[i].id.indexOf('my Class') == 0
to find out whether a layer belongs to your class.

Of course it is doubtful whether Netscape 4 is still worth the efforts,
some static functioning HTML page should suffice for Netscape 4 users.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #5
Thomas 'PointedEars' Lahn <Po*********@we b.de> wrote in message news:<3F******* *******@Pointed Ears.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.myClas sName.visibilit y = "hide"; to hide it and
document.myClas sName.visibilit y = "show"; to show it.

My CSS for this function is:

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


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

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


You cannot reference CSS classes like objects. Instead, iterate
through the collection of DIV elements (use document.getEle mentsByName,
document.getEle mentsByTagName 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
getElementsByTa gName doesn't work in NN4.x? Is there another way to
get the className for a DIV or a layer?
Jul 20 '05 #6
TravelMan wrote:
Thomas 'PointedEars' Lahn <Po*********@we b.de> wrote in message
news:<3F******* *******@Pointed Ears.de>...
It is called attribution _line_.
TravelMan wrote:
[...]
> <style type="text/css">
> ..myClassName {visibility:hid den;}


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


You cannot reference CSS classes like objects. Instead, iterate
through the collection of DIV elements (use document.getEle mentsByName,
document.getEle mentsByTagName 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
getElementsByTa gName 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 referenceToLaye r.visibility is the only way.
(again!) followup-to comp.lang.javas cript

PointedEars

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

Jul 20 '05 #7
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 #8
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 #9

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

Similar topics

15
65766
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 remove them? If the browser is Netscape I can use javascript: window.toolbar.visible = false; window.menubar.visible = false; but IE produces the error: "'window.toolbar.visible' is null or not an object".
6
1737
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 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.
11
4196
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 me an example of something hidden from the user?
1
6657
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
3356
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 code, but that email addy doesn't work anymore. Since it's Intranet, I put an HTML version on the web for you to look at. The links won't work, of course. Address is
17
2917
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 when the Poodle is upcast to the Dog (in its wildest dreams) it then says "bow wow" where the bernard always says "woof" (see code). Basically, it appears that I'm hiding the poodle's speak method from everything except the poodle. Why would I...
9
4986
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 hiding saves the day. I know there exists one, I'd just like to hear about it. thanks and have a nice day.
3
6575
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 foo( char const ) {} };
162
10293
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 prefix them with 2 underscores, but I hate prefixing my vars, I'd rather add a keyword before it. Python advertises himself as a full OOP language, but why does it miss one of the basic principles of OOP? Will it ever be added to python?
0
10136
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9988
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9811
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8813
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3911
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.