1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Problem with setting more than one values into cookies

Discussion in 'JavaScript' started by goutam.dutta123, Oct 26, 2007.

  1. #1
    Hello experts,

    I want to set the values of my checkboxes into cookies when they are checked.
    here is my code:
    <script language="javascript">
    function keepID(){
    if (document.cookie && document.cookie != ""){
    var old_cookie = document.cookie;
    var fresh_data = document.myform.chkID.value;
    document.cookie= old_cookie + escape(fresh_data);
    }

    else{
    //start new cookie
    fresh_data = document.myform.chkID.value;
    document.cookie = "name=" + escape(fresh_data);
    }

    alert (unescape(document.cookie));
    }
    </script>

    My checkboxes are moving in a loop:
    <input type="checkbox" name="chkID" id="chkID" value="<?=$rowSubjects['ID']?>" onClick="keepID()">
    Please help.........
     
    goutam.dutta123, Oct 26, 2007 IP
  2. joesgraphics

    joesgraphics Peon

    Messages:
    206
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Have you got a page were you are testing this and what is it outputing in the alert
     
    joesgraphics, Oct 27, 2007 IP