$(function() { //检查是否登录 if($("#bookstaus").length>0) { $.ajax( { type:"post", cache:false, url:webroot+"plug/book.asp?act=islogin", error:function(){}, success:function(_) { $("#bookstaus").html(_); } }); } }) //提交 function checkbook(the) { the.send.disabled=true; if($.trim(the.t0.value)=="") { $.message({content:"\u6635\u79f0\u4e0d\u80fd\u4e3a\u7a7a"}); the.t0.focus(); the.send.disabled=false; return false } if($.trim(the.t1.value)=="") { $.message({content:"\u7559\u8a00\u5185\u5bb9\u4e0d\u80fd\u4e3a\u7a7a"}); the.t1.focus(); the.send.disabled=false; return false } if(strlen($.trim(the.t1.value))<5) { $.message({content:"\u7559\u8a00\u5185\u5bb9\u81f3\u5c11\u8f93\u5165\u0035\u4e2a\u5b57\u7b26"}); the.t1.focus(); the.send.disabled=false; return false } if($.trim(the.t2.value)=="") { $.message({content:"\u8054\u7cfb\u7535\u8bdd\u4e0d\u80fd\u4e3a\u7a7a"}); the.t2.focus(); the.send.disabled=false; return false } if(!mobileonly($.trim(the.t2.value))) { if(!telonly($.trim(the.t2.value))) { $.message({content:"\u8054\u7cfb\u7535\u8bdd\u586b\u5199\u9519\u8bef"}); the.t2.focus(); the.send.disabled=false; return false } } if(the.t4.value=="") { $.message({content:"\u9a8c\u8bc1\u7801\u4e0d\u80fd\u4e3a\u7a7a"}); the.t4.focus(); the.send.disabled=false; return false } var data; data="t0="+encodeuricomponent($.trim(the.t0.value)); data+="&t1="+encodeuricomponent($.trim(the.t1.value)); data+="&t2="+$.trim(the.t2.value); data+="&t3="+encodeuricomponent($.trim(the.t3.value)); data+="&t4="+encodeuricomponent($.trim(the.t4.value)); $.ajax( { type:"post", cache:false, url:webroot+"plug/book.asp?act=add", data:data, success:function(_) { var act=_.substring(0,1); var info=_.substring(1); switch(act) { case "0": $.message({type:"warn",content:info,time:3000}); the.send.disabled=false; break; case "1": $.message({type:"ok",content:info,time:2000}); if(!$("#nicekname").attr("readonly")){the.t0.value="";} the.t1.value=""; the.t2.value=""; the.t4.value=""; $("#sex").attr("value","0"); $("#booklen").html("255"); the.send.disabled=false; //settimeout(function(){location.href='?';},1500) break; case "2": $.message({type:"ok",content:info,time:2000}); if(!$("#nicekname").attr("readonly")){the.t0.value="";} the.t1.value=""; the.t2.value=""; the.t4.value=""; $("#sex").attr("value","0"); settimeout(function(){location.href='?';},1500) break; default: alert(_); break; } } }); return false }