Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Cookie - Create and Store a Cookie in JavaScript

<script type="text/javascript">
function setCookie(c_name,value,exdays)
{
    var exdate=new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
    document.cookie=c_name + "=" + c_value;
}

// Set the value of Cookie 
 setCookie("username","Anonymous",365);

</script>