Thanks in Advance for any help on this - its truely sending my
head in loops... so I appreciate your efforts!
okay, I have a javascript listed below that drops down submenus
contained within:
<div class="small" style="display: none" id="menu1_menu">
when the heading is clicked:
<a href=.. onClick="expandDiv('menu1')">
- This works perfect in IE, NS6 (I Think), but not NS7 or
FireFox. I know my issues lay in the 'var Browsers = ' and
document.layers, getElementById. The menu is opened and set
using the function setMenu() called elsewhere... menu1 is the
default, but it does store a cookie if this changes to menu2,
menu3 etc...
Essentially i'd like this to work for all browsers - in fact its
essential it does :( - Please stop me from loosing anymore hair
- Regards Lee
var ua = navigator.userAgent;
var opera = /opera [56789]|opera\/[56789]/i.test(ua);
var ie = !opera && /msie [56789]/i.test(ua);
// preventing opera to be identified as ie
var moz = !opera && /mozilla\/[56789]/i.test(ua);
// preventing opera to be identified as mz
function getCookie(NameOfCookie)
{
if (document.cookie.length > 0)
{
begin = document.cookie.indexOf(NameOfCookie+"=");
if (begin != -1)
{
begin += NameOfCookie.length+1;
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end)); }
}
return "menu1";
}
function setCookie(NameOfCookie, value, expiredays)
{
var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 *
3600 * 1000));
document.cookie = NameOfCookie + "=" + escape(value) +
((expiredays == null) ? "" : "; expires=" +
ExpireDate.toGMTString());
}
function closeall()
{
var objs;
if (ie)
{
objs = document.all.tags("DIV");
}
else if (ua)
{
objs = document.getElementById("DIV");
}
else if (document.layers)
{
objs = document.layers["DIV"];
}
else
{
alert('Non supported browser');
}
for (var i=0; i<objs.length; i++) {
if (objs[i].className == "small")
{
objs[i].style.display = "none";
}
}
}
function expandDiv(tahw) {
setCookie("menu", tahw, 7);
closeall();
what = tahw + "_menu"
if (document.getElementById(what).style.display == "none") {
document.getElementById(what).style.display = "";
} else {
document.getElementById(what).style.display = "none";
}
}
function setmenu()
{
var menuvar;
menuvar = getCookie("menu");
expandDiv(menuvar);
}
----------------------------------------------
Posted with NewsLeecher v2.0 Beta 5
* Binary Usenet Leeching Made Easy
* http://www.newsleecher.com/?usenet
----------------------------------------------