PDA

View Full Version : Switch Menu II Cookies prob!



_tech_dude_
09-30-2006, 09:06 AM
1) Script Title: Switch Menu II

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/switchmenu2.htm

3) Describe problem: how can i disable the cookies (ie tends to block them) and defalt the menus to be closed on the page load.

jscheuer1
09-30-2006, 09:37 AM
Find this line in xpmenuv21.js -


function UpdateUserCookie(aryIndex)
{
date = new Date();
date.setTime(date.getTime() + (1000 * 60 * 60 * 24 * 30));
document.cookie = "xpMenuCookv2" + "=" + escape(menuObjArray[4].toString()) + "; expires=" + date.toGMTString();

}

and comment it out -


function UpdateUserCookie(aryIndex)
{
date = new Date();
date.setTime(date.getTime() + (1000 * 60 * 60 * 24 * 30));
// document.cookie = "xpMenuCookv2" + "=" + escape(menuObjArray[4].toString()) + "; expires=" + date.toGMTString();

}

It's not clear if you also want the menus closed or if that was a part of your description of the problem but, to have any given menu closed, use:


<div class="subMenu" style="display:none;">

_tech_dude_
09-30-2006, 12:09 PM
ie still blocks the content, even with that line commented...

Edit: is there anyway to stop i.e from blocking the menu?

jscheuer1
09-30-2006, 03:07 PM
What do you mean by blocks the content or blocks the menu? Anyways, I should have added to my previous post that any existing cookie will still control the display of the page. Also, that if the script is cached, it will still set the cookie. So, you need to clear both your cache and your cookies.

One other thought, if by blocking the menu you mean the security bar, that is a local only 'feature' of IE that is activated by any javascript. Does this happen on the demo page that's live here on Dynamic Drive? If not, it will not happen with your code either once the page is live.