aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes Div / Visibility Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Div / Visibility Problem" Watch "Div / Visibility Problem" New topic
Author

Div / Visibility Problem

Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 764
Cna someone please tell me why the code inside the case that will handle Netscape is not working? The check for document.layers handles Netscape fine but when the inside code is reached it gives an error. Below is the function that is called when a button on the form is pressed, then the div tag line, and then the error message I received. I'd greatly appreciate any help you could give. Thanks.
Rob
============================================
if (document.all) {
document.isearch.all.GenSearchID.style.visibility = (document.isearch.all.GenSearchID.style.visibility == 'visible' ? 'hidden' : 'visible');
} else if (document.layers) {
document.isearch.GenSearchID.style.visibility = (document.isearch.GenSearchID.style.visibility == true ? false : true);
} else {
document.isearch.GenSearchID.visibility = (document.isearch.GenSearchID.visibility == 'visible' ? 'hidden' : 'visible');
}
==========================================
<div id="GenSearchID" style="display: none">
==========================================
document.isearch.GenSearchID has no properties.
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 764
Hey,
Does anyone know why out there in the WebWorld?
Rob
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
The reason why is you are using the wrong code for netscape.
IE-->document.all
NN4-->document.layers
NN6+-->document.getElementById
getElementById is also supported by modern IE browsers
now to hide the div with NN4 you need to use a layer tag and surround the div. since NN4 does not support duv but the layer tag. Great Huh!?!
The syntax you are using is making me wonder. What is isearch??
document.all.DIVname.style.visibility=""
document.getElementById.DIVname.style.visibility=""
document.layers.DIVname.visibiity=""
Eric
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50674

And ponder for a moment: is it really worth all the time and hassle to special-case functionality for NN4 when it has such a miniscule market share at this point?
bear


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
Take a look at this

http://www10.brinkster.com/a1ien51/JavaRanch/showhidetoggle.htm
Eric
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 764
Hi Eric,
The isearch is actually the form that has the div tag in it. I've been trying different things to get this to work so at the final point of frustration I grabbed the code and posted it. Thanks all for the help.
Rob
 
 
subject: Div / Visibility Problem
 
Threads others viewed
Hide form elements in Netscape4.7
JavaScript onchange question
NetScape 6 show/hide
JSP search/forwarding
creating status bar
IntelliJ Java IDE