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
    SEMrush
     
    mberman84, Dec 3, 2008 IP
    SEMrush
  2. pharmboy

    pharmboy Member

    Messages:
    30
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    43
    #2
    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