[Javascript] DIV scripting pickle

Peter Brunone peter at brunone.com
Tue May 1 14:34:40 CDT 2001


    I'm trying to make a DIV disappear and reappear on command.  I've done
this a LOT before.  I've done it in this page that I'm working now.
HOWEVER, for some crazy reason, Netscape has decided to crap out on me.
What little detail am I missing?
    I have a DIV named "pleaseWaitDiv" that I alias according to the browser
type into an object called "pleaseWait".  I also assign it the following
class:

.waitDiv {
 position:absolute;
 visibility:hide;
 visibility:hidden;
 top:20%;
 left:40%;
 }

    The first visibility is for IE; the second is for Netscape.  IE does its
job just fine, but NN ignores the hide part.  I tried hiding it with
scripting (again, it works with another DIV on the same page) using Dan
Steinman's hideObject and showObject functions, and then by explicitly
commanding it, but I'm being told that the object has no properties.  Here's
the remainder of the code that I use to manipulate the ornery DIV:


if(document.all) {
 var queryInput = document.all.queryInputDiv.style;
 var pleaseWait = document.all.pleaseWaitDiv.style;
 var ie4 = true;
 var ns4 = false;
 }
else {
 alert("Netscape");  // This comes up just fine
 var queryInput = document.queryInputDiv;
 var pleaseWait = document.pleaseWaitDiv;
 var ns4 = true;
 var ie4 = false;
 }

function showObject(obj) {
 if (ns4) obj.visibility = "show";
 else if (ie4) obj.visibility = "visible";
 }

function hideObject(obj) {
 if (ns4) obj.visibility = "hide";
 else if (ie4) obj.visibility = "hidden";
 }

    It's like the thing doesn't exist.  I've checked to see if maybe there's
another object with the same name, but came up with nothing.  Thoughts?

Thanks,

Peter





More information about the Javascript mailing list