Closed Thread Icon

Preserved Topic: Layer Visibility/onMouseover... Pages that link to <a href="https://ozoneasylum.com/backlink?for=17771" title="Pages that link to Preserved Topic: Layer Visibility/onMouseover..." rel="nofollow" >Preserved Topic: Layer Visibility/onMouseover...\

 
Author Thread
joealsip
Obsessive-Compulsive (I) Inmate

From:
Insane since: Jun 2000

posted posted 06-25-2000 05:16

How can i toggle the visibility of a CSS layer or a <layer> with onMouseover?

Bugimus
Maniac (V) Mad Scientist

From: New California
Insane since: Mar 2000

posted posted 06-25-2000 10:09

Let's say you defined your DIV or Layer like this:

code:
<DIV ID="layername" style="position:absolute; visibility:hidden; left:0; top:0; width:18; height:18;"> ....... </DIV>



Then you could create show and hide functions that set it's visibility attribute. IE and Netscape differ on how to do this:

code:
function show() {
if(Netscape)
document.layername.visibility = "visible";
else
layername.style.visibility = "visible";
}
function hide() {
if(Netscape)
document.layername.visibility = "hidden";
else
layername.style.visibility = "hidden";
}



Then all you would have to do is call these functions from the onMouseover event like:

code:
<a href="..." onMouseover="javascript:show();">show my layer</a>

<a href="..." onMouseover="javascript:hide();">hide my layer</a>



I hope this helps.

DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: Stockholm, Sweden
Insane since: Mar 1994

posted posted 06-25-2000 23:34

That work for me, but wouldn't you call that in the onMouseover like this...?

<a href="..." onMouseover="show();">show my layer</a>
<a href="..." onMouseover="hide();">hide my layer</a>




Your pal, -doc-<P>

Bugimus
Maniac (V) Mad Scientist

From: New California
Insane since: Mar 2000

posted posted 06-26-2000 03:24

Oops, hee hee, thanks Doc.

eedn
Bipolar (III) Inmate

From: Midlothian, VA USA
Insane since: Mar 2000

posted posted 06-26-2000 17:00

When is it specifically that Netscape requires you to use "show" and "hide"? Sometimes it will just come up with an error if that's not specified for Netscape.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 06-26-2000 18:41

Couple of things Netscape might choke on:
First if the DIV you are trying to show is nested in another i.e.:

<DIV ID="one">
<DIV ID="two">
</DIV>
</DIV>

if you are trying to show or hide DIV two you need to call it like this:
document.one.two.visibility = "visible";

Netscape will also choke on style info in the DIV tag (this is my favorite rant) DO NOT put DIV style info in the DIV tag i.e.
<DIV ID="one" style="visibility:hidden"> NN will not recognize it, instead put it in your STYLE info in your head tag
<STYLE>
#one {visiblity:'visible'}
</STYLE>

Three you need to detect NN for this to work, something like this preferably right under your opening script tag.

<SCRIPT>
Netscape = (document.layers) ? 1:0;

cool?


Walking the Earth like Kane

« BackwardsOnwards »

Show Forum Drop Down Menu