Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

cookie set from select created with javascript from external file- not working - help

Question posted by: Ed (Guest) on July 20th, 2005 09:09 AM
I have a dropdown menu that is populated by an external file with the
use of a script.

I want to place the results of this in a cookie.
My cookie works great for the user_name and user_phone...but I can't get
this ad code to work correctly...the cookie does not save that
information. What have I done wrong?

<head>
<script language="JavaScript">
function setCookie() {
var expiresDate = new Date();
expiresDate.setFullYear(expiresDate.getFullYear() + 1);
document.cookie = encodeURI("user_name="
+ document.twork.proc_by.value) + "; expires="
+ expiresDate.toUTCString();
document.cookie = encodeURI("user_phone="
+ document.twork.procphone.value) + "; expires="
+ expiresDate.toUTCString();
document.cookie = encodeURI("ad"
+
document.twork.ad_code.options[document.twork.ad_code.selectedIndex].value)
+ "; expires="
+ expiresDate.toUTCString();
}
</script>
</head>

<body>
<script language="JavaScript">
document.write("<select name=\"ad_code\" id=\"ad_code\" size=\"1\"
class=\"regSoft\" onBlur=\"doSetAd()\">");
for(i=0; i<divCodes.length; i++){
document.write("<option>");
document.write(divCodes[i]);
document.write("</option>");
}
document.write("</select>");
</body>

Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
 
Not the answer you were looking for? Post your question . . .
173,562 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors