By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,648 Members | 1,203 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,648 IT Pros & Developers. It's quick & easy.


P: n/a
I have done alot of web work in all sorts of languages but I have never used
the simple cookie. Question is
How does one set and retrieve a simple session cookie. All it will do is
have an image change on 1 page only with every new visitor, there are 5
images it should be random and stay the same unless the session is ended.
Sounds pretty simple but I cannot find simple examples of a cookie doing
anything similar to this. I found oodles of stuff on what a cookie is and
how it works but I could use an example, even if someone knows a website
that has simple clear examples, and to prove my ignorance what prog.
language are they written in. I have always used variables associated with a
db in asp but asp is not an option so it looks like html or JavaScript ????

Here is a simple image rotator but how would you set the cookie and check to
see if it is a new session for the rotator?
image = new Array(3);
image[0] = 'images/bodymidrow1col2.jpg'
image[1] = 'images/bodymidrow1col2_2.jpg'
image[2] = 'images/bodymidrow1col2_3.jpg'
index = Math.floor(Math.random() * image.length);
document.write("<IMG SRC="+image[index]+" height=120>");

Jul 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.