Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

onLoad:toggleMenu

Name: ­ 2007-09-10 11:21 ID:KCod0X3n

I'm making a website and in it, I have it so that the menu is hidden by default and when you click a button it shows the menu.

A simplified version of what i'm using is this:
<html>
<head>
<title>menu</title>
<script type="text/javascript">
function toggleMenu(list, img){
    var listElement = document.getElementById(list);
    listElement.style.display = (listElement.style.display == "none") ? "block" : "none";
    img.src = (img.src == "images/menu.jpg");
}
</script>
<head>
<body>
<div id="menu head"><img title="Click here to toggle the menu" src="images/menuhead.jpg" onclick="toggleMenu('menu', this)"/></div>
<div id="menu" style="display:none;"><img src="images/menu.jpg"/></div>
</body>
</html>


I'm trying to make it so that when you click a link in the menu it will load the new page with the menu showing.

It occurred to me that maybe appending a '#' to the end of the link, thus differentiating the 'toggled' link from the 'hidden' one, and then somehow making the page detect that and toggling the menu.

Assuming that makes any sense, I have no idea where to start...

I was thinking of something like this, but really I have no idea... <_<
<script type="text/javascript">
function getURL()
    {
    var url = document.URL;
    removeDomainName = url.split(".html");
    if ( # == DomainName ) return domainName;
    return true;
    document.onLoad.toggleMenu = ('menu', this);
    }
</script>
<body onLoad="getURL()">

I would really appreciate any help.

Name: Anonymous 2007-09-10 11:26 ID:Heaven

This board is about programming.

Name: Anonymous 2007-09-10 11:27 ID:h217AH3G

>>2
LOL

Name: Anonymous 2007-09-10 11:38 ID:/FrPfi9P

>>1
Mr Cod o'Xen,

You have the right sort of idea. Use window.location to check what URL your page was visited at.



Name: Anonymous 2007-09-10 22:58 ID:KCod0X3n

bamp

Name: Anonymous 2007-09-11 0:09 ID:rP2zAXfE

>>2
ROFL

but i eat with html , javascript and php , btw

Name: Anonymous 2007-09-11 7:26 ID:UdYfpCR6

Use a cookie. When the user shows the menu set a cookie. Check on your page if the cookie is set and if so show the menu.

Name: Anonymous 2009-03-06 8:15

The expressions shall have   type pointer to   it Help please   I am getting   SICP and a   half to find   where it will   come to you   to choose it   over a lot   of software to   support Sun products   based on Java   has been accepted   is because it   was too difficult   to implement just.

Name: Anonymous 2009-07-12 6:31

and Here. with.  with. people ideas

Don't change these.
Name: Email:
Entire Thread Thread List