467,116 Members | 1,167 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,116 developers. It's quick & easy.

cookies

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?
<SCRIPT LANGUAGE="JavaScript">
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("<DL>\n");
document.write("<IMG SRC="+image[index]+" height=120>");
</SCRIPT>

Priti
Jul 20 '05 #1
  • viewed: 1133
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Brian Burgess | last post: by
20 posts views Thread by Brian Burgess | last post: by
1 post views Thread by John Taylor-Johnston | last post: by
6 posts views Thread by Mark | last post: by
6 posts views Thread by Stephane | last post: by
1 post views Thread by Alex Nitulescu | last post: by
reply views Thread by rn5a@rediffmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.