I am having a problem with getting a popup if someone has already entered their information on the website. I don’t have noob in the title, but I am. Looking to see what I am doing wrong. Thank you, here is the JavaScript that I’m having issues with: (I am not familiar with posting, so don’t know where the area I’m suppose to put my code)
<code>
<!–
function getCookie(name) {
var results = document.cookie.indexOf(name + “=”);
var len = sPos + name.length + 1;
if((!sPos) && (name != document.cookie.substring(0, name.length))){
return null;
}
if(name == -1){
alert(“You have already submitted your information. Thank you.”);
}
if(address == -1){
alert(“You have already submitted your information. Thank you.”);
}
if(email == -1){
alert(“You have already submitted your information. Thank you.”);
}
var ePos = document.cookie.indexOf(‘;’, len);
if(ePos == -1) ePos = document.cookie.length;
return unescape(document.cookie.substring(len, ePos));
}
function setCookie(name, value, expires, path, domain, secure){
var today = new Date();
if(expires){
expires = expires * 1000 * 3600 * 24;
}
document.cookie = name+’=’+escape(value) +
((expires) ? ‘;expires=’ + new Date(today.getTime() + expires).toGMTString() : ”) +
((path) ? ‘;path=’ + path : ”) +
((domain) ? ‘;domain=’ + domain : ”) +
((secure) ? ‘;secure’ : ”);
}
function deleteCookie(name, path, domain){
if(getCookie(name)){
setCookie(name, ”, -30, path, domain);
}
}
function testFunction(){
var c = parseInt(getCookie(‘Value’));
if(!c){
alert(‘No initial ValuenSetting New CookienValue : 0’);
setCookie(‘Value’, 1);
}else{
alert(‘Stored CookienValue : ‘ + c);
alert(‘Setting New CookienValue : ‘ + (c + 1));
setCookie(‘Value’, (c + 1));
}
deleteCookie(‘Value’);
}
//–>
</code>