/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function setCookie() { var name = prompt('Name of the cookie'); var value = prompt('Value of the cookie'); var expires = prompt('Cookie expiration date'); var path = prompt('Cookie path scope'); var domain = prompt('Domain path scope'); var secure = confirm('secure'); var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); document.cookie = curCookie; return curCookie; }
URL: http://www.arachna.com/edu/tutorials/mini/cookies/javascript.html