[thelist] Trouble writing JS cookie in NN 4

Bob Haroche spambait at onpointsolutions.com
Fri Oct 18 11:02:00 CDT 2002


I'm having trouble with writing a cookie in NN4. The idea is to allow a
person to check a form box on a terms of service page, the effect of which
is to set a cookie allowing the visitor to bypass the TOS page in the
future.

The script works in IE/Opera/NN 6 but not in NN4.  If the form is inside an
AP layer (div), NN4 reports it has no properties; if it's outside the <div>,
it works fine. Any ideas? TIA.

 Here's the simplified code:


<script language="JavaScript" type="text/javascript">
<!--
 expireDate = new Date
 expireDate.setYear(expireDate.getYear()+1)

 if (document.cookie != "") {
  if (document.cookie.indexOf("TOSagreed=yes") >= 0) {
  location.href = "http://domain.com/next-page.html";
  }
 }

 function setCookie() {
  if (document.TOSform.RememberMe.checked == true) {
  document.cookie = "TOSagreed=yes;expires=" + expireDate.toGMTString();
  }
 }
// -->
</script>


<div id="Layer1" style="position:absolute; left:50px; top:50px; z-index:1">
  <form name="TOSform" method="post" action="">
    <input type="button"  value="Submit"
onClick="setCookie();window.location.href='http://domain.com/next-page.html'
">
    <input type="checkbox" name="RememberMe" value="SkipPage">
    Skip this page in the future.
  </form>
</div>


---------------
Regards,
Bob Haroche
O n P o i n t  S o l u t i o n s
www.OnPointSolutions.com






More information about the thelist mailing list