The following code isn't working. What I want to do is to write to the page or alert the user that they don't have cookies enabled if this in fact the case from their browser settings. This is to allow the user to check a checkbox so they don't see an informational screen again when they come back to our application. Any suggestions are welcome! Thanks!

So, here's what's in my <HEAD> tag:

<script language="javascript">

document.cookie = "cookiesenabled4=yes";

function createCookie(name,value,days)


if (document.cookie.indexOf("cookiesenabled4=") == -1)//means the user has cookies disabled on their browser


document.write("Please enable cookies in order to allow this window to be avoided, if desired, in the future!");

alert("You must allow cookies!");


else//cookies are allowed, so set this one from the checkbox1 onclick event


if (days) {

var date = new Date();


var expires = "; expires="+date.toGMTString();


else var expires = "";

document.cookie = name+"="+value+expires+"; path=/";




Here's what I have for my checkbox onclick event:


<input id="Checkbox1" type="checkbox" onclick="createCookie('ppkcookie3','testcookie',60);"/>

Don't show me again!