Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 12-19-2007, 03:10 AM Cookie Popup Issue
SHydroxide's Avatar
Skilled Talker

Posts: 74
Name: Steve
Location: Canuckistan
Trades: 0
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.
SHydroxide is offline
Reply With Quote
View Public Profile Visit SHydroxide's homepage!
 
 
Register now for full access!
Old 12-19-2007, 02:15 PM Re: Cookie Popup Issue
kline11's Avatar
SearchBliss Web Tools

Posts: 1,788
Name: John
Location: USA
Trades: 0
Here is the easiest way for me to help you.

You can simply build a pop-up ad here that generates the ad code and a cookie in javascript. You can choose weather or not to have it pop-up on every page load (annoying), or pop-up one time per user.

Fell free to refer to the cookie code for your current project as well.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
kline11 is offline
Reply With Quote
View Public Profile
 
Old 12-19-2007, 05:52 PM Re: Cookie Popup Issue
SHydroxide's Avatar
Skilled Talker

Posts: 74
Name: Steve
Location: Canuckistan
Trades: 0
Quote:
Originally Posted by kline11 View Post
Here is the easiest way for me to help you.

You can simply build a pop-up ad here that generates the ad code and a cookie in javascript. You can choose weather or not to have it pop-up on every page load (annoying), or pop-up one time per user.

Fell free to refer to the cookie code for your current project as well.
K, so, I lied, it's not a popup... Go look up greybox; it's actually a floating element still in the browser, not a separate window, so that won't work for me.
__________________
This is my edited bleeding signature.
SHydroxide is offline
Reply With Quote
View Public Profile Visit SHydroxide's homepage!
 
Old 12-19-2007, 05:56 PM Re: Cookie Popup Issue
SHydroxide's Avatar
Skilled Talker

Posts: 74
Name: Steve
Location: Canuckistan
Trades: 0
Quote:
Originally Posted by kline11 View Post
Here is the easiest way for me to help you.

You can simply build a pop-up ad here that generates the ad code and a cookie in javascript. You can choose weather or not to have it pop-up on every page load (annoying), or pop-up one time per user.

Fell free to refer to the cookie code for your current project as well.

Also, that tool is ****ing terrible, because the pop-up doesn't work in my browser on their test site. Phail.
__________________
This is my edited bleeding signature.
SHydroxide is offline
Reply With Quote
View Public Profile Visit SHydroxide's homepage!
 
Old 12-19-2007, 06:55 PM Re: Cookie Popup Issue
kline11's Avatar
SearchBliss Web Tools

Posts: 1,788
Name: John
Location: USA
Trades: 0
It isn't a new browser window, BTW, but I'm sorry it won't work for you. Just trying to help.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
kline11 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Cookie Popup Issue
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15146 seconds with 12 queries