Hi all ?
I have a bit of a problem with remembering current pathway (selection in menu) and I need your help. I am new to JavaScript.
But let’s get back to where it’s started. I am currently developing a simple CMS in PHP & MySQL. Most of work is already finished, bu now I have to tweak some functionalities in increase user experience ?
One of it is folding menu (tree menu). I am generating it in PHP and currently I’m using simple JavaScript to expand/collapse submenus (folders). Idea is simple – when an expandable list item (<li>) is clicked (onmouseclick) a simple JS funtion is executed that display a child list (<ul>) and in this way I am building a simple tree menu. The function is following:
[CODE]function showHide(msg_id)
{
var element = document.getElementById(msg_id);
element.style.display = element.style.display==’block’ ? ‘none’ : ‘block’;
}
The problem is that when I click an list item (that leads to certain article) in a submenu, whole page is reloaded and all previously opened submenus collapse. I would like to have expanded elements that are leading to the last one that I clicked.
How can I achieve it? Can you provide me some links to tutorials? Or maybe giva a hint how to tweak my function?
I was trying to google some help but I probably use wrong keywords…