<script>
function setCookie(){
days=7;
myDate = new Date();
myDate.setTime(myDate.getTime()+(days*24*60*60*1000));
document.cookie = 'CookieName=value; expires=' + myDate.toGMTString();
}
</script>
<a id="url1" href="#" onclick='setCookie()'>ССЫЛКА</a>