That one works better. I know there are more solutions but in my cms I have three menu examples which can be edit by an wysiwyg.
My choice was to make them all work with the following menu's
http://css.alsacreations.com/modelesmenus/hd1.htm
http://css.alsacreations.com/modelesmenus/vd1.htm
http://css.alsacreations.com/modelesmenus/vd1.htm
They all do work exept for the flickering in firefox
I also made a nice addon for the vd1.htm.
The javascript uses a cookie so when you are on a submenu and click on a link the submenu will stay open.
montre(false);
function montre(para) {
if(para == false)
{
for (var i = 1; i<=10; i++)
{
if (document.getElementById('smenu'+i))
{
document.getElementById('smenu'+i).style.display='none';
}
}
var menu_to_open = GetCookie('openmenu');
if(document.getElementById(menu_to_open))
{
document.getElementById(menu_to_open).style.display='block';
}
}else{
var d = document.getElementById(para);
for (var i = 1; i<=10; i++)
{
if (document.getElementById('smenu'+i))
{
document.getElementById('smenu'+i).style.display='none';
}
}
if(para != false)
{
SetCookie('openmenu',para);
}else{
var menu_to_open = GetCookie('openmenu');
if(document.getElementById(menu_to_open))
{
document.getElementById(menu_to_open).style.display='block';
}
}
if (d)
{
d.style.display='block';
}
}
}
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name,value,expires,path,domain,secure) {
document.cookie = name + "=" + escape (value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
Edited by ceasar (14 May 2005 - 15:19)