Closed Thread Icon

Topic awaiting preservation: Visibilety and z-index (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=7854" title="Pages that link to Topic awaiting preservation: Visibilety and z-index (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Visibilety and z-index <span class="small">(Page 1 of 1)</span>\

 
Osaires
Paranoid (IV) Inmate

From: oslo, Norway
Insane since: Aug 2001

posted posted 09-22-2001 16:16

Is it posible to change the z-index of a object with javascript, and how does the visibilety function work


mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 09-22-2001 17:51

<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!-- ;

// Written by mr.maX, http://www.max.co.yu/

function getObj(name) {
&nbsp;&nbsp;&nbsp;&nbsp;if (document.getElementById) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return document.getElementById(name).style;
&nbsp;&nbsp;&nbsp;&nbsp;} else
&nbsp;&nbsp;&nbsp;&nbsp;if (document.all) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return document.all[name].style;
&nbsp;&nbsp;&nbsp;&nbsp;} else
&nbsp;&nbsp;&nbsp;&nbsp;if (document.layers) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return document.layers[name];
&nbsp;&nbsp;&nbsp;&nbsp;}
}

function hideLayer(name) {
&nbsp;&nbsp;&nbsp;&nbsp;getObj(name).visibility = "hidden";
}

function showLayer(name) {
&nbsp;&nbsp;&nbsp;&nbsp;getObj(name).visibility = "visible";
}

function getZIndex(name) {
&nbsp;&nbsp;&nbsp;&nbsp;getObj(name).zIndex;
}

function setZIndex(name, z) {
&nbsp;&nbsp;&nbsp;&nbsp;getObj(name).zIndex = z;
}

// -->
</SCRIPT>

Use getZIndex() and setZIndex() functions to get/set z-index value and use hideLayer() and showLayer() functions to hide/show layers...

Osaires
Paranoid (IV) Inmate

From: oslo, Norway
Insane since: Aug 2001

posted posted 09-22-2001 18:13

Does it work in older version of IE and NN? . I found the function named "display" works in the same way as visiblety function i think

document.all.somthing.style.display ="block" //show
document.all.somthing.style.display ="none" //hidde

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 09-22-2001 18:23

Doesn't work exactly the same. Changing it's display to 'none' makes it so if there are any other HTML elements after it in the page, they behave as though it weren't there, and fill up the space that it would take otherwise. Changing visibility would leave a hole where it was, because the other HTML elements still think it's there, so they don't fill up its space.

By the way, you're calling these things "functions":

document.all.somthing.style.display ="block"; // statement

they're actually called "statements". You can use a function in a statement, like this:

changeSomething(); // call the "changeSomething" function

Just wanted to clear up that vocabulary issue.

Max's functions should work fine in older versions of NN and IE.

Osaires
Paranoid (IV) Inmate

From: oslo, Norway
Insane since: Aug 2001

posted posted 09-22-2001 18:31

Yes i know slime, i diden't fine the word
btw. congratilation with 2100 post's



[This message has been edited by Osaires (edited 09-22-2001).]

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 09-22-2001 18:36

Besides differences that Slime pointed out above, you should also know that "display" CSS property doesn't work in Netscape 4...

« BackwardsOnwards »

Show Forum Drop Down Menu