这是一个简单的;假设我有一个从数据库中提取值的脚本,并且每次用户单击按钮时,该值都会减少一个计数,我如何防止该值降至零以下,
if(count>0){
$.post(sessionStorage.server, { count:count ,request:"counter",user:sessionStorage.sname });
}
if(count==0){
alert("Your value is now zero");
sessionStorage.clear();
sessionStorage.msg="Logged off, ran out of clicks";
window.location.href = "../index.html";
}