[thelist] Javascript Help Needed

Feingold Josh S Josh.S.Feingold at irs.gov
Thu Apr 25 08:03:09 CDT 2002


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--
[ Picked text/plain from multipart/alternative ]
Here is some code I am developing:

First I set a cookie on the page which records the value of a textarea in a
form.

document.cookie = "textarea=" + document.cutnpaste.cutnpaste.value +
";expires=09-Nov-15;"

Then, when the page is reloaded I try to make the previously recorded cookie
appear back in the textarea.

function displaycookies() {
     if (document.cookie) {
          cookies = document.cookie.split(';')
          for (x=0;x<cookies.length;x++) {
               splitcookie = cookies[x].split('=')
               if (splitcookie[0] == 'textarea') {
                    document.cutnpaste.cutnpaste.value = splitcookie[1]
               }
          }
     }
}

When I check the value of splitcookies[x], it tells me it is 'textarea'.
However, the test for splitcookie[0] == 'textarea' always fails.

Does anyone know what I am doing wrong?

Thanks,
Josh



More information about the thelist mailing list