Hi everyone. I am trying to get my delivery schedule set.
What I am looking for is a way for users to input their zip codes, and a popup come up detailing the minimum order for free delivery.
I want to create a cookie for this as well, for repeat customers, but I also need to be able to drop the cookie to select a new zip code. Here is what I have so far...
It is not working.HTML Code:<script type="text/javascript"> function getCookie(c_name) { var i,x,y,ARRcookies=document.cookie.split(";"); for (i=0;i<ARRcookies.length;i++) { x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); x=x.replace(/^\s+|\s+$/g,""); if (x==c_name) { return unescape(y); } } } 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; } function checkCookie() { var zipcode=getCookie("zipcode"); if (zipcode!=null && zipcode!="") { alert("Your Shipping Zip-Code is: " + zipcode); <!-- Function to Change Zip-Code, or empty cookie !--> } else { zipcode=prompt("Please enter your Zip-Code:",""); if (zipcode!=null && zipcode!="") else if(zipcode==32218); alert(" Minimum order for Delivery is: $500.00") else if (zipcode==35983); alert("Minimum order for Delivery is: 300.00") else alert("We do not deliver in your area."); { setCookie("zipcode",zipcode,365); } } } </script> </head> <body onload="checkCookie()">
Thanks for any help.



Reply With Quote
Bookmarks