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