PDA

View Full Version : Please help a beginner with cookies


chesneil
07-12-2002, 03:37 PM
My mission (and I have to accept it) is to use cookies to:

i) record the previous visit date and the number of times visited, then

ii) use it to put different messages on the page (not alerts) according to whether it's a first visit or not, and according to the period between visits:
a) for the first visit: one message ("Welcome" or whatever),
b) for subsequent visits within a week of the previous visit: another message; and
c) for subsequent visits more than a week after the previous visit: yet another message.

I'm just beginning to learn Javascript and am not at the stage where I can manipulate any code that I cut 'n paste - including cookies. So I would be VERY grateful if someone could give me the complete code to do the above. Please...! I have a deadline on this!

Many thanks.

jalarie
07-12-2002, 06:23 PM
I'm not interested in doing your homework for you, but I'll point you to the "Samples of my work > Cookies" page at my site for some help. My site address is:

  http://spruce.flint.umich.edu/~jalarie/

chesneil
07-13-2002, 11:42 AM
I'm not interested in doing your homework for you...


Actually, it's for work. But anyway, was that really necessary? I thought this was a place to get help. Replying to say you're not going to help me...? As I mentioned, I don't know enough javascript to manipulate any similar codes. The scripts on your homepage are beyond my understanding at this point. When I've learnt all this stuff I won't ask for complete codes, but right now I have a task which is beyond me. Hence my request.

Thank you for your reply.

WA
07-13-2002, 12:06 PM
I think jalarie could have been a lot more diplomatic (apologies on behalf). Anyhow, there are people who literally post their school "assignments" for others to do, so some members here are a little sensitive to posts that resemble those.

Cookies isn't my strong suit, but with the right JavaScript cookie routine (there are lots of canned ones out there), your question shouldn't be too hard to answer. Instead of just putting up a link to his site, Jalarie should have been more specific. His cookie page (which looks quite helpful) can be found here:

http://spruce.flint.umich.edu/~jalarie/jaa_kce.htm

Also, you may want to check the source of some of the cookie scripts on JavaScriptKit.com, which illustrate portions of what you wish to accomplish:

http://www.javascriptkit.com/script/cutindex7.shtml

Good luck,

chesneil
07-13-2002, 12:30 PM
Thanks WA. Now I understand what jalarie meant! I'll check out your links.
Appreciated,
Chesneil

jalarie
07-15-2002, 02:28 PM
I'm sorry; I misjudged your request. I hope that my Cookies page helped you, and you're welcome to e-mail me directly at jalarie@umich.edu for more help if you wish.

chesneil
07-16-2002, 12:59 AM
jalarie,
No worries - I understand now. Thanks for your offer. I may take you up on it if I have problems. I'm learning 'on the job', which is a great motivator but also means I get things to do without enough time to master the subject from scratch, as in this case.
Cheers,
Chesneil

chesneil
07-22-2002, 03:01 PM
Solved it. Thanks guys.

http://www.codingforums.com/showthread.php?threadid=2433