Come on guys please help out!
To get things started, here's the code I'm currently using...
COOKIE SCCRIPT
Code:
<SCRIPT LANGUAGE="JavaScript">
<!--
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 "here";
i=document.cookie.indexOf(" ",i)+1;
if (i==0) break;
}
return null;
}
var visit=GetCookie("COOKIE1");
if (visit==null){
var expire=new Date();
window.name = "thiswin";
newwin=open("welcome.asp", "dispwin",
"width=360,height=288,scrollbars=no,menubar=no");
document.cookie="COOKIE1=here; expires=Thu 01-01-2008 00:00:00 GMT;";
}
// -->
</SCRIPT>
This sets my cookie and it works great! Now I need to find out how to incorporate a center popup script to work with this...
I found this, but am unsure how to incorporate the two as this 'center popup script' requires that the body onload event be present, and that adds the popup link which is a bad thing as its already incorporated in the code above?? i.e. both scripts call the popup, and thus dont work together.
CENTER POPUP SCRIPT
Code:
<SCRIPT LANGUAGE="JavaScript">
<!--
function popup( filename, params, width, height, resizable, scrollbars, windowName, centered )
{
if ( width == 0 ) width = screen.availWidth - 20;
if ( height == 0 ) height = screen.availHeight - 20;
if ( centered == true ) {
topX = (screen.availWidth/2)-(width/2);
topY = (screen.availHeight/2)-(height/2);
} else {
topX = 20;
topY = 20;
}
if ( params != "" ) params = "?" + params;
window.open( filename + params, windowName, "resizable=" + resizable + ",scrollbars=" + scrollbars + ",top=" + topY + ", left=" + topX + ",width=" + width + ",height=" + height);
}
PopUp = function( width, height )
{
this.page = "";
this.params = "";
this.width = width;
this.height = height;
this.resizable = "yes";
this.scrollbars = "auto";
this.windowName = "win" + new Date().getMilliseconds();
this.centered = true;
}
PopUp.prototype.getPageLink = function()
{
return this.page + (this.params != "" ? "?" + this.params : "");
}
</head>
<body OnLoad="javascript:popup('welcome.asp','',360,288,'no','no','popup',true)">
// -->
</SCRIPT>[/
Hope someone can help!