Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Show/hide layers driving me crazy...

Can't back up to first layer after second layer is shown



12:25 pm on Aug 13, 2003 (gmt 0)

10+ Year Member


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>layer test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link href="some.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;

function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }

<div id="navig" class="1"> <a href="#" onClick="MM_showHideLayers('hidden1','','show')">
show hidden 1 </a>
<a href="#" onClick="MM_showHideLayers('hidden2','','show')">
show hidden 2 </a> </div>

<div id="visiblefrombegin" class="scrollbox">
this is from begining visible layer</div>

<div id="hidden1" class="2">here is firs hiden layer</div>
<div id="hidden2" class="2">here is second hiden layer</div>




layers shows as it meant to, but when I u click on second layer and its shows, u cant "call" firs layer eny more.. I can't figure out why?! But maybe you have a clue?

thanx in advance


[edited by: tedster at 7:07 pm (utc) on Aug. 13, 2003]
[edit reason] turn off graphic smile faces [/edit]


3:55 pm on Aug 13, 2003 (gmt 0)

WebmasterWorld Senior Member blobfisk is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Hi carramba :) - and welcome to WebmasterWorld!

I'm a little biased, but check out this show-hide layer script [webmasterworld.com].

You may find it easier to work with...



6:16 pm on Aug 13, 2003 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Every time I see a script with MM_ in the function names, I cringe. Reverse engineering for Macromedia's automatic code can be a nightmare.

So I agree with BlobFisk's "prejudice", do check out the link. I don't want MacroMedia being the "master" of my web, and you may enjoy being back in control of your own code as well.

[edited by: tedster at 7:14 pm (utc) on Aug. 13, 2003]


6:42 pm on Aug 13, 2003 (gmt 0)

10+ Year Member

Yeah I agry with you but in that thread is all about mouse over and nav meniu.. I want quaite a different thing.

Featured Threads

Hot Threads This Week

Hot Threads This Month