C
Connie Walsh
Hi:
I gleaned a javascript off of the web:
http://www.hypergurl.com/popup.html
that sets a cookie everytime someone visits your site. If it is the
first visit in x number of days then a popup will appear. It would be
great for my application but I can't get it to work. Here is my code:
http://www.software-in-a-box.com/shop/skin_default/template.html
Here is where my site is displayed (and the popup should show up):
http://www.software-in-a-box.com/shop
Here is a snippet of my code. I tried putting open.window's in my code
in the checkcount and getcookie functions and no window was opened. Is
there an easier thing to debug with. I use safari and I hear it has no
debugger...sux. I have no idea what was going on. I tried netscape still
no windows.
Thanks for any help you can provide.
Connie
<html>
<head>
<title>Software-In-A-Box.com</title>
<meta description="A computer software company that sells computer games
and other computer software to
consumers">
<meta keywords="computer software, computer games, computer stuff>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<script LANGUAGE="Javascript">
<!-- Hide javascript from older browsers --
function PopUp(theURL,winName,features)
{window.open(theURL,winName,features);}
// end hide -->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
..txt1 {
font: 10px Tahoma;
color: #5A5A5A;
}
..txt2 {
font: 11px Tahoma;
color: #5A5A5A;
}
..txt3 {
font: 11px Tahoma;
color: #5A5A5A;
}
body,td,th {
font-size: 10px;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
<!-- Begin
var expDays = 2; / number of days the cookie should last
var page =
"http://www.software-in-a-box.com/shop/skin_default/popup.html"; /URL to
the pop-up
var windowprops = ""; / variables
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function amt(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','1')
return 1
}
else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
}
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function checkCount() {
var count = GetCookie('count');
if (count == null) {
count=1;
SetCookie('count', count, exp);
window.open(page, "", windowprops);
}
else {
count++;
SetCookie('count', count, exp);
}
}
/ End -->
</script>
</head>
<body style="padding:0;margin:0 " onLoad="checkCount()" >
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
I gleaned a javascript off of the web:
http://www.hypergurl.com/popup.html
that sets a cookie everytime someone visits your site. If it is the
first visit in x number of days then a popup will appear. It would be
great for my application but I can't get it to work. Here is my code:
http://www.software-in-a-box.com/shop/skin_default/template.html
Here is where my site is displayed (and the popup should show up):
http://www.software-in-a-box.com/shop
Here is a snippet of my code. I tried putting open.window's in my code
in the checkcount and getcookie functions and no window was opened. Is
there an easier thing to debug with. I use safari and I hear it has no
debugger...sux. I have no idea what was going on. I tried netscape still
no windows.
Thanks for any help you can provide.
Connie
<html>
<head>
<title>Software-In-A-Box.com</title>
<meta description="A computer software company that sells computer games
and other computer software to
consumers">
<meta keywords="computer software, computer games, computer stuff>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<script LANGUAGE="Javascript">
<!-- Hide javascript from older browsers --
function PopUp(theURL,winName,features)
{window.open(theURL,winName,features);}
// end hide -->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
..txt1 {
font: 10px Tahoma;
color: #5A5A5A;
}
..txt2 {
font: 11px Tahoma;
color: #5A5A5A;
}
..txt3 {
font: 11px Tahoma;
color: #5A5A5A;
}
body,td,th {
font-size: 10px;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
<!-- Begin
var expDays = 2; / number of days the cookie should last
var page =
"http://www.software-in-a-box.com/shop/skin_default/popup.html"; /URL to
the pop-up
var windowprops = ""; / variables
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function amt(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','1')
return 1
}
else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
}
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function checkCount() {
var count = GetCookie('count');
if (count == null) {
count=1;
SetCookie('count', count, exp);
window.open(page, "", windowprops);
}
else {
count++;
SetCookie('count', count, exp);
}
}
/ End -->
</script>
</head>
<body style="padding:0;margin:0 " onLoad="checkCount()" >
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>