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

Discussion in 'Javascript' started by Ed, Jul 16, 2003.

  1. Ed

    Ed Guest

    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);
    document.write("</option>");
    }
    document.write("</select>");
    </body>
     
    Ed, Jul 16, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alan Silver
    Replies:
    1
    Views:
    471
    Alan Silver
    Jun 20, 2006
  2. Replies:
    5
    Views:
    587
    Aaron Watters
    May 2, 2008
  3. Replies:
    2
    Views:
    480
  4. Xeno Campanoli
    Replies:
    2
    Views:
    159
    Xeno Campanoli
    Jul 10, 2008
  5. Phil Powell
    Replies:
    2
    Views:
    200
    Grant Wagner
    Sep 5, 2003
Loading...

Share This Page