/    Sign up×
Community /Pin to ProfileBookmark

Hi everybody ! It’s me again, with my div menu…
First, a little summary of the past episodes.
I wanted to know how it was possible to hide and show multpile divs by clicking on a link. The point was to make a menu.
Palros gave me a fine working script ( THANKS ! ), and then, I wanted to make something a bit funnier : to have the different divs slide in when we click on the link. Of course, I didn’t want them to slide in all together, that would be too easy ( and ugly ). I wanted them to come one after the other, from the right of the page. ( or the left, or the top, or the bottom, it doesn’t really matter).
Palros again gave me a script : delaySlide() and Slide(), but I can’t get them to work. I’m sure I’ve done something wrong with the html part, and it certainly has something to do with the ” and the ‘…
If somebody could help me out of this, I would be very gratefull !!!

Here is the code

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<title>Document sans titre</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<link href=”fond.css” rel=”stylesheet” type=”text/css”>

<script language=”JavaScript” type=”text/javascript”>
<!–
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName==”Netscape”)&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function slide(div)
{
var div_left = document.getElementById(div).style.left;
if (div_left < 0){
document.getElementById(div).style.left = div_left + 10+”px”;
setTimeout(“slide(‘”+div+”‘)”,500)
}
}

function delaySlide(div,delay)
{
if(arguments.length == 2)
setTimeout(“slide(‘”+div+”‘)”,delay);
else
{
for (var i=0; i<arguments.length; i+=2)
{
setTimeout(“slide(‘”+arguments[i]+”‘)”,arguments[i+1]);
}
}
}

function showHide(div_id)
{
if (arguments.length == 1) {
if (document.getElementById(div_id).style.display == “block”)
document.getElementById(div_id).style.display=”none”;
else
document.getElementById(div_id).style.display=”block”;
}
else {
for (var i=0; i<arguments.length; i++) {
if (document.getElementById(arguments[i]).style.display == “block”)
document.getElementById(arguments[i]).style.display=”none”;
else
document.getElementById(arguments[i]).style.display=”block”;
}
}
}

//–>

</script>
<script>
var styleSheet=’violet.css’;
</script>

</head>

<body>
<div id=”Layer3″ style=”position:absolute; left:45px; top:64px; width:390px; height:66px; z-index:3; background-color: #0000FF; layer-background-color: #0000FF; border: 1px none #000000;”><a onClick=”showHide(‘barre1′,’barre2′,’barre3′,’oneone’); delaySlide(‘barre1’,1000);”><img src=”site/pixel.gif” width=”100%” height=”100%”></a></div>
<div id=”Layer1″ style=”position:absolute; left:20px; top:144px; width:489px; height:428px; z-index:1″>
<iframe allowtransparency=”true” frameborder=”0″ height=”100%” width=”100%” id=”cadre” name=”cadre” src=”edito.htm” style=”FILTER: chroma(color=#ffcc99)” >

</iframe>
</div>
<div id=”Layer2″ style=”position:absolute; left:542px; top:183px; width:177px; height:367px; z-index:2; display:block”>
<table width=”177″ border=”0″ cellspacing=”5″ cellpadding=”0″>
<tr>
<td height=”37″><div id=”barre1″ style=”display: none”><div id=”oneone” style=”display: none”><a href=”http://enfantsdelo.free.fr”>Tafa</a></div></div></td>
</tr>
<tr>
<td height=”38″><div id=”barre2″ style=”display: none”><div id=”onetwo” style=”display: none”><a href=”http://enfantsdelo.free.fr”>Tafa</a></div></div></td>
</tr>
<tr>
<td height=”38″><div id=”barre3″ style=”display: none”><div id=”onethree” style=”display: none”><a href=”http://enfantsdelo.free.fr”>Tafa</a></div></div></td>
</tr>
<tr>
<td height=”37″><div id=”barre4″ style=”display: none”></div></td>
</tr>
<tr>
<td><div id=”barre5″ style=”display: none”></div></td>
</tr>
<tr>
<td><div id=”barre6″ style=”display: none”></div></td>
</tr>
<tr>
<td><div id=”barre7″ style=”display: none”></div></td>
</tr>
<tr>
<td><div id=”barre8″ style=”display: none”></div></td>
</tr>

</table>
</div>
</body>
</html>

it’s just a test version, so don’t attach yourself to the strangeness of the page… lol !!!
I wonder about the Slide and showHide together… Maybe there is some conflict, as the div need to be diplayed as block when it slides, and… yeah… I don’t know…

Also, I would know if it’s possible to have an array or something with all the div id’s, and put that into the function.
Like : menu1 = oneone + onetwo + barre1 + barre2
menu2 = twoone +twotwo + twothree + barre1 + barre2 + barre 3
don’t pay attention to the syntax, it’s just because I haven’t checked the correct syntax yet. I just want to know if it’s possible, because then, the getElementById wouldn’t work, or is there any solution to make it work ???
Thanks for all suggestions !!!
Ness

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@scragarJan 26.2005 — how about a link?
Copy linkTweet thisAlerts:
@Ness_du_FratauthorJan 26.2005 — what do you mean ?
Copy linkTweet thisAlerts:
@scragarJan 26.2005 — A link to the page with the menus in. That way I can atleast test them with the same opotions you have.
Copy linkTweet thisAlerts:
@Ness_du_FratauthorJan 26.2005 — erh, actually not. I haven't put anything on the server yet... Do you really need it to test it ? if I have a syntax error, it must be quite ovious, I guess... I'll try to pass the files on my website, when I'm on my computer again.
Copy linkTweet thisAlerts:
@herodote92Jan 26.2005 — Problem on line 26. Netscape says 'delaySlide is not defined', IE says 'div is not defined'. But both agree about line 26.
Copy linkTweet thisAlerts:
@Ness_du_FratauthorJan 26.2005 — Yep. Firefox agrees too. But I don't know what's wrong... I don't really understand this precise part about the sliding. The rest is quite obvious, but I've problems about the Slide function...
Copy linkTweet thisAlerts:
@herodote92Jan 27.2005 — What about defining delaySlide as a function ? From what I can see, you call this function but never define it.
Copy linkTweet thisAlerts:
@Ness_du_FratauthorJan 27.2005 — Oups, you're right... I corrected this on the first test, but then I forgot all about it and after deleting and pasting again, the "function" was forgotten... I'll try it right away !
Copy linkTweet thisAlerts:
@Ness_du_FratauthorJan 27.2005 — false alarm, it still doesn't work, but this time, I don't get any error on the page with the console...

I'm lost !!! It should work !!!
×

Success!

Help @Ness_du_Frat spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...