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.

Setting cookies with javascript?

Discussion in 'JavaScript' started by mberman84, Dec 3, 2008.

  1. #1
    how do i set a cookie with javascript?

    this is what i have:

    var cookie_date = new Date ( );
    document.cookie = "clickcookie=clicked; expires=" + cookie_date.toGMTString();
    Code (markup):
    this doesnt seem to work. what am i doing wrong? i want to set a cookie called "clickcookie"...and i want it to expire in 30 days
    mberman84, Dec 3, 2008 IP
  2. pharmboy

    pharmboy Member

    Likes Received:
    Best Answers:
    Trophy Points:
    How do you know it's not working? Keep in mind that you can't see the cookie on the same page load.
    pharmboy, Dec 4, 2008 IP