Forum Moderators: open
I am building a kids (no profit) site and though I am presently learning JS in a tech college here in ozland, I am not able to write or modify a cookie username script which would be a real treat for my site surfers.
I am looking for something like the macomedia username which stores the details, but also writesIn "if this is not +user+ click here. I assume this reloads the page and clears the cookie at the same time. This is precisely where I am having the problem. I have a username script without that extra bit. Can anyone suggest where I can find this script?
thanks again
antipodes
<script>
function getCookie(NameOfCookie)
{
if(document.cookie.length > 0)
{
begin = document.cookie.indexOf(NameOfCookie+"=");
if(begin!= -1)
{
begin += NameOfCookie.length + 1;
end = document.cookie.indexOf(";",begin);
if(end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin,end));
}
}
return null;
}
function delCookie(NameOfCookie)
{
if(getCookie(NameOfCookie)){
document.cookie = NameOfCookie +"=" +
";expires= Thu, 01-Jan-70 00:00:01 GMT";
}
}
</script>
Document.write("If you are not " + getCookie() + " then <a href='javascript:delCookie()'>click here</a>");
My js cookie ablities are quite rusty. You can find the original tutorial I changed here:
[scriptbreaker.com...]