Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works

Setting A Cookie To Remember Selection

  • Please log in to reply

The G

The G


  • Member
  • PipPipPip
  • 136 posts
This is probably rather easy to solve, but I'm no good at cookie coding.

What I'm trying to do is get a drop down menu (where they select an image) remember people's selection if they re-fresh the page or whatever, this is what I have

<script language="javascript">

function getCookieExpireDate(noDays){
  var today = new Date()
  var expr = new Date(today.getTime()+noDays*24*60*60*1000)
  return  expr.toGMTString()
function makeCookie(name, data, noDays){
  var cookieStr = name + "="+ data
  if (makeCookie.arguments.length > 2){
	cookieStr += "; expires=" + getCookieExpireDate(noDays)
  document.cookie = cookieStr

/*Combo Box Image Selector:
By JavaScript Kit (www.javascriptkit.com)
Over 200+ free JavaScript here!

function showimage()
if (!document.images)


<table border="0" cellspacing="0" cellpadding="0">
<td width="100%"><form name="mygallery"><p><select
name="picture" size="1" onChange="showimage()">
<option selected value="picture1">pic1</option>
<option value="picture2">pic 2</option>
<option value="picture3">pic3</option>
<td width="100%"><p align="center"><img src="pic" name="pictures" width="99"

Any help would be fantastic.
  • 0


Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP