SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Hide Layer OnClick?
-
Feb 24, 2001, 14:32 #1
- Join Date
- Aug 2000
- Location
- N.S., Canada
- Posts
- 487
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi,
Can someone tell me how I hide a layer when someone clicks a link? I used to know how but I forget.
Thanks,
Justin Sampson
-
Feb 25, 2001, 04:50 #2
- Join Date
- Feb 2001
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
bru i got quite a large script that does not only hide layers but a load of other cool layer funtions i really think you'll enjoy this
so i'll mail you the whole script rather than post it the example is a bit big.... but you can make it smaller
for yourself
-
Feb 25, 2001, 11:36 #3
- Join Date
- Apr 2000
- Location
- Melbourne, Australia
- Posts
- 2,571
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
A JavaScript function to hide a layer given its ID is:
Code:function hideLayer(layerid) { if (document.getElementById) { // DOM-compliant browsers (MSIE5, NSN6, O5) document.getElementById(layerid).style.visibility='hidden'; } else if (document.all) { // MSIE4 return document.all[layerid].style.visibility='hidden'; } else if (document.layers) { // NSN4 return document.layers[layerid].visibility='hidden'; } else { // Trap DHTML-impaired browsers //alert("Your browser does not support DHTML!"); return false; } }
Code:<a href="javascript:hideLayer('myLayer');">...</a>
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference
Bookmarks