Expandable menu – how to trace and leave opened last clicked element?

Hi folks :)

Currently I am developing a simple CMS in PHP and MySQL. I almost finished it but got stuck with displaying menu.

Idea is basic – for displaying menus I use PHP and generate it with <ul> & <li> items. If I want a sub-menu I open another <ul> within <li> tags. To enable expanding (opening it) and collapsing it, I use a simple JS function:

Code:

function showHide(msg_id)
{
        var element = document.getElementById(msg_id);
        element.style.display = element.style.display=='block' ? 'none' : 'block';
}


But every time I click a link wich is not "a folder item" (it does not containt any sub-menu) and page reloads to display an article, all submenus collapse. I would like to have expanded the sub-menu which contained a link that was clicked. How to achieve it?

I will appreciate any help with JS functions or links to tutorials…

PS. I am totally new to JS. I tried to google it, but since english is not my native language I probably use wrong keywords…

View full post on Webmaster-Talk.com

, , , , , , ,

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get Adobe Flash playerPlugin by wpburn.com wordpress themes


RSS Site FeedRSS Site Feed

© 1992-2011 DC2NET™, Inc. All Rights Reserved