daveVk

msg:3963516 | 2:56 am on Aug 1, 2009 (gmt 0) |
Try w3schools [w3schools.com...] for starters. Welcome to forum.
|
Arno_Adams

msg:3963638 | 9:51 am on Aug 1, 2009 (gmt 0) |
Hmm, sounds a lot like home work... Tom
|
thegrinder

msg:3963895 | 9:30 pm on Aug 1, 2009 (gmt 0) |
Yes it is homework and i can't do it so i need help. Cheers
|
Arno_Adams

msg:3964103 | 9:51 am on Aug 2, 2009 (gmt 0) |
Was daveVk's suggestion any help?
|
astupidname

msg:3964121 | 11:53 am on Aug 2, 2009 (gmt 0) |
Questions 1 & 2 you should be able to determine by a quick google of "javascript cookies" and trying a few things out on your own. I will tackle question #3: the reason it is a good idea (in some cases) to store the date the cookie was set, is that you can not access the cookies expiration date (due to browser security restrictions) after the cookie has been set. Some times you may want your program to know if the users particular cookie is about to expire or not, and the only way to know is to know the date it was set and the duration it was set for (the duration is normally a constant you have pre-determined and won't usually need to be stored in the cookie's value).
|
thegrinder

msg:3964237 | 4:52 pm on Aug 2, 2009 (gmt 0) |
Would question 1 answer be something like this?: document.cookie = "name=John; setTime=03-28-2005; bgColor=red; fgcolor=green;" And if there is only 1 cookie string why di i need 4 cookies? Isn't 4 properties of the same cookie? Regarding question 2 would it be something like this:? function get_cookie ( cookie_name ) { var results = document.cookie.match ( '(^¦;) ?' + cookie_name + '=([^;]*)(;¦$)' ); if ( results ) return ( unescape ( results[2] ) ); else return null; } All i would need to do is to add the colors and date parametres? I don't know how to do this (question 2..), cookies are a pain :( Thanks for your help!
|
daveVk

msg:3964360 | 12:14 am on Aug 3, 2009 (gmt 0) |
The previous reference shows the setCookie function, use this 4 times to set 4 name/value pairs. Note that document.cookie does not directly represent what is stored in cookie, a read of document.cookie will not return what is written to document.cookie, document.cookie = ... adds to cookie. What is wrong with the method of retrieving cookie show in reference ? Try your solution using 'try it' link, this should give you good idea of how it works.
|
|