PDA

View Full Version : Switch Content



jscheuer1
02-15-2006, 09:47 PM
This function from step one of Switch Menu (http://www.dynamicdrive.com/dynamicindex1/switchmenu.htm) needs the part in red to avoid errors in IE under certain circumstances. Since there is no reason why 'end' needs to be a global variable and it is a simple change, I am reporting it here even though it doesn't cause an error on the demo page.


function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
var end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}