[thelist] Javascript Help Needed
Chris Blessing
webguy at mail.rit.edu
Thu Apr 25 08:16:01 CDT 2002
Josh-
Are you sure the test is failing? It looks like you may need to change
this:
document.cutnpaste.cutnpaste.value = splitcookie[1]
to this:
document.cutnpaste.value = splitcookie[1]
HTH!
Chris Blessing
webguy at mail.rit.edu
http://www.330i.net
> 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