I have made several attempts to save a cookie with the dropdown menu form.
I have taken code directly from the HTML Goodies, the only thing I changed was the form.
Is there a special way to save cookies with the dropdown menu form?
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 3.2//EN”>
<html>
<head>
<!– javascript functions in here –>
<SCRIPT LANGUAGE=”JavaScript”>
cookie_name = “dataCookie”;
var YouEntered;
function putCookie() {
if(document.cookie != document.cookie)
{index = document.cookie.indexOf(cookie_name);}
else
{ index = -1;}if (index == -1){YouEntered=document.cf.cfd.value;document.cookie=cookie_name+”=”+YouEntered+”; expires=Monday, 04-Apr-2010 05:00:00 GMT”;}}
</SCRIPT>
</head>
<body>
<FORM NAME=”cf”>
<!— (original code) Enter A Word: <INPUT TYPE=”text” NAME=”cfd” size=”20″> —>
<!— begin new form here —>
<SELECT NAME=”cfd” SIZE=”1″><OPTION SELECTED>Blue<OPTION>Red<OPTION>Yellow<OPTION>Green<OPTION>Black<OPTION>Orange<OPTION>Purple</SELECT>
<!— end new form —>
<INPUT TYPE=”button” Value=”Set to Cookie”
onClick=”putCookie()”>
</FORM>
</body>
</html>
This is only a cookie test code. I eventually will need to save about eight cookies from eight dropdown menus.