Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how can i get and set cookie value using javascript
Posted

Let me share with you one of the secrets[^] known only to the top level of professional developers.
 
Share this answer
 
thank you Christian Graus for your interest , but im sorry your link is not available in my country because of security proxy, thanks
 
Share this answer
 
Try this[^].
 
Share this answer
 
thank you Christian Graus its help me so here is the code :)

function SetCookie()
{

var level=document.getElementById('<%=Drop1.ClientID %>').value;
var txt1=document.getElementById('<%= Textbox1.ClientID %>').value;
set_cookie("level",level); set_cookie("drop";txt1);
// you can get the cookie value using this line
get_cookie("level");

}

function get_cookie ( cookie_name )
{
var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
if ( results )
return ( unescape( results[2] ) );
else
return null;
}

function set_cookie ( name, value)
{
var cookie_string = name + "=" + escape ( value );
document.cookie = cookie_string;
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900