Hi,
I've got a popup that I'm going to set to load only for IE6 users, and only once per browser session (the code below is missing the IE6 tags, for ease of testing).
I can get the popup method to work fine, without the code for the cookie. The code for the popup itself is pretty straightforward:
Code:
AJS.AEV(window, 'load', function() {
GB_showCenter("", "http://www.oxidephoto.ca/upgrade.htm", 380, 420);
});
And if I load that into script tags it works just fine. However, with the cookie code as below, it's not loading the popup anymore.
Can someone look at the JS below and let me know where I've gone awry?
Thanks!
Code:
<script type="text/javascript">
var GB_ROOT_DIR = "http://www.oxidephoto.ca/greybox/";
var ckTemp = document.cookie;
function setCookie(name, value) {
if (value != null && value != "")
document.cookie=name + "=" + escape(value) + ";";
ckTemp = document.cookie;
}
function getCookie(name) {
var index = ckTemp.indexOf(name + "=");
if(index == -1) return null;
index = ckTemp.indexOf("=", index) + 1;
var endstr = ckTemp.indexOf(";", index);
if (endstr == -1) endstr = ckTemp.length;
return unescape(ckTemp.substring(index, endstr));
}
function checkCookie() {
var temp = getCookie("popup");
if(!temp==1) {
setCookie("popup",1);
AJS.AEV(window, 'load', function() {
GB_showCenter("", "http://www.oxidephoto.ca/upgrade.htm", 380, 420);
});
}
}
</script>
<script type="text/javascript" src="greybox/AJS.js"></script>
<script type="text/javascript" src="greybox/AJS_fx.js"></script>
<script type="text/javascript" src="greybox/gb_scripts.js"></script>
<link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" />
</head>
<body onLoad="javascript:checkCookie();">
__________________
This is my edited bleeding signature.
|