homepage Welcome to WebmasterWorld Guest from 54.145.243.51
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Show/hide layers driving me crazy...
Can't back up to first layer after second layer is shown
carramba

10+ Year Member



 
Msg#: 703 posted 12:25 pm on Aug 13, 2003 (gmt 0)

code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<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; }
}
//-->
</script>
</head>

<body>
<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>

</body>
</html>

****************************************************

problem:

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

carramba

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

 

BlobFisk

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



 
Msg#: 703 posted 3:55 pm on Aug 13, 2003 (gmt 0)

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...

HTH

tedster

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



 
Msg#: 703 posted 6:16 pm on Aug 13, 2003 (gmt 0)

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]

carramba

10+ Year Member



 
Msg#: 703 posted 6:42 pm on Aug 13, 2003 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved