User:Ammu Susheela/common.js: Difference between revisions
Jump to navigation
Jump to search
Matt Pijoan (talk | contribs) (Blanked the page) |
Matt Pijoan (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
function setCookie(cname, cvalue, exdays) { | |||
var d = new Date(); | |||
d.setTime(d.getTime() + (exdays * 60 * 1000)); | |||
var expires = "expires=" + d.toUTCString(); | |||
document.cookie = cname + "=" + cvalue + "; " + expires; | |||
} | |||
function getCookie(cname) { | |||
var name = cname + "="; | |||
var ca = document.cookie.split(';'); | |||
for (var i = 0; i < ca.length; i++) { | |||
var c = ca[i]; | |||
while (c.charAt(0) == ' ') | |||
c = c.substring(1); | |||
if (c.indexOf(name) != -1) | |||
return c.substring(name.length, c.length); | |||
} | |||
return ""; | |||
} | |||
if(getCookie("attn")!="1"){ | |||
alert("Come see me when you get a sec --Matt"); | |||
setCookie("attn", "1", 365); | |||
} |
Revision as of 16:17, 24 September 2015
function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays * 60 * 1000)); var expires = "expires=" + d.toUTCString(); document.cookie = cname + "=" + cvalue + "; " + expires; } function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1); if (c.indexOf(name) != -1) return c.substring(name.length, c.length); } return ""; } if(getCookie("attn")!="1"){ alert("Come see me when you get a sec --Matt"); setCookie("attn", "1", 365); }