Click to See Complete Forum and Search --> : "Do Not Remind Me" script required


Rik Comery
06-12-2003, 04:02 AM
I have built a home page with a PopUp window. To stop the window being annoying, i have found a cookie so the box only shows once per user session.

What i would really like instead, is a tick box in the popup window to say something like "Do Not Remind Me Again". If the user ticks this box, the window should close and they will never see the window again.

Does anyone know of such a cookie. I have searched everywhere, but cannot find anything like. Unfortunately, my JavaScript knowledge does not extend to writing cookies, only modifying them.

Khalid Ali
06-12-2003, 06:12 AM
This what you could do.
create an input type checkbox in the popup
in the onclick event call of the checkbox use js function, may be...

Process();

in the process function set the expiration time for cookie to be reallllly long time...... that way cookie will not expire and they will not see the popup.
this is if rest of the code you mentioned works perfectly...:D

pyro
06-12-2003, 07:34 AM
I've used something like this on a site I made...

popup code:
<html>
<head>
<title>Popup</title>

<script language="javascript" type="text/javascript">

function setCookie(myCookieName, myCookieValue, myCookieTime) {
var cookieDies = new Date();
cookieDies.setTime(cookieDies.getTime() + myCookieTime*365*24*60*60*1000);
document.cookie = myCookieName+"="+myCookieValue+";expires=" + cookieDies.toGMTString();
}

function setCookieOne() {
if(document.cookieForm.setCookie.checked) { //Check if checkbox is checked
setCookie(popupCookie, 'true', 10); // ('Cookie_Name', 'Cookie_Value', 1) Last number is length of time to last in years
}
}

</script>

</head>

<body>

Your message here...
<form name="cookieForm">
<input name="setCookie" type="checkbox" method="get" onClick="setCookieOne()">
Click the checkbox to bypass this message on future visits.
</form>
<a href="#" onClick="window.close()">Close Window</a></div>

</body>
</html>

main page code:
<html>
<head>
<title>Popup</title>

<script language="javascript" type="text/javascript">

var page = "rickcomery_popup.htm";
var windowproperties = "width=550,height=300,location=yes,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes";
var name = "popup";

var mycookie = document.cookie.indexOf("flashCookie=");

if (mycookie == -1) {
window.open(page, name, windowproperties);
}

</script>

</head>

<body>
</body>
</html>