Hi all, any one got 2 mins to help with this?
Javascript to set a cookie =
<!-- Hide script from older browsers
now = new Date
expireDate = new Date
expireDate.setMonth(expireDate.getMonth()+6)
lastVisit = new Date(cookieVal("pageVisit"))
document.cookie = "pageVisit="+now+";expires=" + expireDate.toGMTString();
function cookieVal(cookieName) {
pageVisit = document.cookie.split("; ")
for (i=0; i<pageVisit.length; i++) {
if (cookieName == pageVisit.split("=")[0]) {
return pageVisit.split("=")[1]
}
}
return "1 January 1970"
}
function newCheck(yyyy,mm,dd) {
lastChgd = new Date(yyyy,mm-1,dd)
if (lastChgd.getTime() > lastVisit.getTime()) {
document.write("<a href='main.html'>Enter The Site</a>")
}
}
else {
window.location=("main.html")
}
Within my html file i have the following:
<script language="javascript" type="text/javascript">
<!-- Hide script from older browsers
newCheck(2007,2,21)
// End hiding script -->
</script>
Any ideas why this isn't writing the cookie to the computer?
Javascript to set a cookie =
<!-- Hide script from older browsers
now = new Date
expireDate = new Date
expireDate.setMonth(expireDate.getMonth()+6)
lastVisit = new Date(cookieVal("pageVisit"))
document.cookie = "pageVisit="+now+";expires=" + expireDate.toGMTString();
function cookieVal(cookieName) {
pageVisit = document.cookie.split("; ")
for (i=0; i<pageVisit.length; i++) {
if (cookieName == pageVisit.split("=")[0]) {
return pageVisit.split("=")[1]
}
}
return "1 January 1970"
}
function newCheck(yyyy,mm,dd) {
lastChgd = new Date(yyyy,mm-1,dd)
if (lastChgd.getTime() > lastVisit.getTime()) {
document.write("<a href='main.html'>Enter The Site</a>")
}
}
else {
window.location=("main.html")
}
Within my html file i have the following:
<script language="javascript" type="text/javascript">
<!-- Hide script from older browsers
newCheck(2007,2,21)
// End hiding script -->
</script>
Any ideas why this isn't writing the cookie to the computer?