Jump to content

Creating Cookies? Not Working Correctly


dzhax

Recommended Posts

I have this code for making a cookie.

function popup_show(remove_id){  document.cookie = 'remove=something';}

that will make the cookie remove with a value of somthingnow if i do this

function popup_show(remove_id){  document.cookie = remove_id;}

or

function popup_show(remove_id){  document.cookie = escape(remove_id);}

It does not set the cookie. It leaves it NULL.remove_id = 'remove=11' when sentCan someone help?

Link to comment
Share on other sites

typical cookie setting and getting script:

function set_cookie( name, value, exp_y, exp_m, exp_d, path, domain, secure ) {  var cookie_string = name + "=" + escape ( value );  if ( exp_y )  {    var expires = new Date ( exp_y, exp_m, exp_d );    cookie_string += "; expires=" + expires.toGMTString();  }  if ( path )        cookie_string += "; path=" + escape ( path );  if ( domain )        cookie_string += "; domain=" + escape ( domain );    if ( secure )        cookie_string += "; secure";         document.cookie = cookie_string;  }function get_cookie(cookie_name){  var results = document.cookie.match( '(^| ?' + cookie_name + '=([^;]*)(;|$)' );  if ( results )    return ( unescape ( results[2] ) );  else    return null;}function setthiscookie(remove_id){  set_cookie("remove_id", remove_id);}function getthiscookie()    {    var thiscookievalue = get_cookie("remove_id");     }

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...