This is layer ID sec1
This is the lowest layer in the z-index order.
This is layer ID sec2
This is the 2nd lowest layer in the z-index order.
This is layer ID sec3
This is the 2nd highest layer in the z-index order.
This is layer ID sec4
This is the highest layer in the z-index order.
 

 

Big Resources
 BoxedArt
 StockedPhotos
 123Webmaster
 A1Javascripts
 1-Click-Clipart
 FresherImage
 FontFiles
 HTMLforums
 httpCITY
 PerlAccess
 HostRaiders
 
 
BigResources Somewhat Weekly Ezine



 
  Link to Us
Contact Us
Advertise
Careers
Submissions
Privacy
Free Email Signup
Free Email Login
 
 

Click Here!


Unlimited Web Templates

All access to thousands of web templates, logos, icons, more...


Royalty Free Stock Photos

All access to thousands of professional stock photos


Turnkey Website Templates
Fully scripted PHP website templates!

<script language="Javascript">
  Hide/Show Multiple Layers in IE4-5, NS4-6
</script>


Layer Hiding and Showing
CROSS-BROWSER w/ FULL 4.X, 5.X, and 6.x SUPPORT!!

Written by
XBDHTML Guru

This is a more complex method of working with multiple layers. Attention will need to made to the layer naming convention, hide sequences, and Javascript Function design (what is the specific Function doing?).

This method of hiding and showing layers is designed to be used with layers that require related layers to interact with each other. For demonstration purposes, each layer here has been offset 10 pixels to the left from the previous layer and the layer z-index is increased.

Show All
Show Layer 1, Hide 2, 3, and 4
Show Layer 3, Hide 1, 2 and 4
Show Layer 4, Hide 1, 2 and 3






There are several parts to making this work:

  • DIV/SPAN defined style
    This is defined within the embedded style portion at the top of the page. Each layer MUST have the same prefix (in this case: "sec") followed by a sequential number.

  • Javascript - Part 1
    ALL JavaScript MUST be placed in the section of the page.
    This is the browser detection routine that sets-up the DOM.

  • Javascript - Part 2
    The code to HIDE a set of layers. You will need to repeat each IF/ELSE for each layer, incrementing the number as you proceed.

  • Javascript - Part 3
    The code to DISPLAY a single layer and HIDE all other layers. Note the "HIDE" function is called first, and it also does NOT have a number assigned to it. This "hides" all layers globally (of the particular suffix set).

  • An Event
    One of various events, onClick, OnMouseover, OnMouseOut etc, to call the pert function.
    Please note that the text (layer name) after the function name must be within parenthesis.



  •  
    Home | Webmasters Tools | Tutorials | Help Forum | Post Your Script
    Essential Scripts | Background Effects | Form Navigation | Games | Midi Related
    MouseOver | Page Effects | Redirection | Site Navigation | Status Bar | Text Effects
    Time Related | User Information | Utilities | Miscellaneous | DHTML Scripts | Links
    A1 JavaScripts Since 1999 - email webmaster

    Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. A1 JavaScript Resources is independent of Sun Microsystems, Inc.

    Copyright.©2002.BIG RESOURCES