[thelist] Trouble writing JS cookie in NN 4

s t e f notabene at members.evolt.org
Sat Oct 19 09:31:12 CDT 2002


<who="Bob Haroche" when="09:01 18/10/02 -0700">
>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.

Mmmh, forget about parsing the whole document to get the form which is
inside the div. I'd rather do this:
onClick="setCookie(this.form);[...]

And alter the setCookie function like so:
function setCookie(f) {
   if (f.RememberMe.checked == true) {
   document.cookie = "TOSagreed=yes;expires=" + expireDate.toGMTString();
}

The 'this' method is almost always easier once you get the hang of it.

Let the browser do the job of locating the form in its particular DOM,
won't we? ;-)

HTH

s t e f
http://nota-bene.org




More information about the thelist mailing list