Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting a cookie outside the homepage

Status
Not open for further replies.

jerschab

Programmer
Apr 17, 2001
10
US
Sorry to ask the same question again, but I know someone has the answer...

I can set a cookie from but I can't set it from I have tried setting the "path=/", but the error in Microsoft Debugger remains the same "Object doesn't support this property or method" - and always breaks at the line where I actually set the cookie (document.cookie=the_cookie --> where the_cookie="user=jeremy;expires="+expire_date). I have tried to mimick exactly what other tutorial web pages are doing, but no luck. There has to be a simple answer, but it is always those simple ones that piss you off the most.

How about testing the page where I have been trying to just make this little cookie stuff work... and see if you can help??? Thanks.
 
I think if you just change the <form name=cookie method=&quot;get&quot;> to <form> it will work fine.
 
No, that isn't it, but thank you for your response...if you went to the web page ( you would see that you can call my (setCookie()) cookie function from either the form button element (as you noticed)

or

from the <a href=&quot;#&quot; onClick=&quot;setCookie(); return false;&quot;>setcookie</a> link...

Any other clues here???
 
Did you try it?
I copied the code to a file on my machine and I got the same error you were describing (Object doesn't support this property or method) when I used both the button and the link. When I changed the <form name=cookie method=&quot;get&quot;> to <form> it worked fine...
 
I think problem is the name=cookie. When you refer to document.cookie it thinks you're talking about the form, I believe...
 
yes, yes, yes...it should be name=&quot;cookie&quot; not name=cookie...

I have fixed it and now it works...I knew this was a simple oversight...check it out and thank you!!
 
I just tried it and I still got the same error. (I checked the code and name=&quot;cookie&quot; was there...)
If I were you I would take the name thing completely out of there so it is just <form method=&quot;get&quot;>. Or change the name to something besides cookie...
 
I changed the <form> part to <form name=&quot;cookieForm&quot;>...it seems that when the form was named &quot;cookie&quot; the document.cookie function was probably confused as you said...anyway, try it again for me to see if it works...thanks for all your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top