/    Sign up×
Community /Pin to ProfileBookmark

Can anyone help me to customize this code?

Hello,

Below pasted code is for a session control popup window on load. I’m trying to customize it as when a user click any link on my page then It have to trigger only once per session, but I’m failed to do so, can any one here please help me to do so.

here is the code:

<SCRIPT LANGUAGE=’JAVASCRIPT’ TYPE=’TEXT/JAVASCRIPT’>
<!–
/****************************************************
AUTHOR: [url]WWW.CGISCRIPT.NET[/url], LLC
URL: [url]http://www.cgiscript.net[/url]
Use the code for FREE but leave this message intact.
Download your FREE CGI/Perl Scripts today!
( [url]http://www.cgiscript.net/scripts.htm[/url] )
*
**
*************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,pos,infocus){
if(GetCookie(“sid”) == “999”){return;}
document.cookie=”sid=999; Path=/; Expires= ” + getFuture(999);
if(pos==”random”){myleft=(screen.width)?Math.floor(Math.random()*
(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos==”center”){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
else if((pos!=’center’ && pos!=”random”) || pos==null){myleft=0;mytop=20}
settings=”width=” + w + “,height=” + h + “,top=” + mytop + “,left=” + myleft + “,scrollbars=yes,location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes”;win=window.open(mypage,myname,settings);
win.focus();}
// Cookie functions borrowed from:
// Ronnie Moore: Visit him at [url]http://www.ronniemoore.com[/url]
function getFuture(f){
var d = new Date();
d.setTime(d.getTime() + (86400000 *
f));
return d;
}

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 getCookieVal (offset) {
var endstr = document.cookie.indexOf (“;”, offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
// –>
</script>

<body onLoad=”NewWindow(‘http://www.cgiscript.net’,’acepopup’,’640′,’480′,’fullscreen’,’front’);”>

Thanks

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @mshmethu spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...