$(function() { //检查是否登录 if($("#comment_staus").length>0) { $.ajax( { type:"post", cache:false, url:webroot+"plug/comment.asp?act=islogin", data:"gourl="+contenturl, error:function(){}, success:function(_) { $("#comment_staus").html(_); } }); } if($("#commenttop").length>0) { $.ajax( { type:"post", cache:false, url:webroot+"plug/comment.asp?act=load&id="+infoid, error:function(){}, success:function(_) { $("#commenttop").html(_); } }); } }) //提交评论 function checkcomment(the) { the.send.disabled=true; if($.trim(the.t0.value)=="") { $.message({content:"\u8bc4\u8bba\u5185\u5bb9\u4e0d\u80fd\u4e3a\u7a7a"}); the.t0.focus(); the.send.disabled=false; return false } if(strlen($.trim(the.t0.value))<5) { $.message({content:"\u8bc4\u8bba\u5185\u5bb9\u81f3\u5c11\u8f93\u5165\u0035\u4e2a\u5b57\u7b26"}); the.t0.focus(); the.send.disabled=false; return false } var data; data="t0="+encodeuricomponent($.trim(the.t0.value)); data+="&t1="+encodeuricomponent($.trim(the.t1.value)); $.ajax( { type:"post", cache:false, url:webroot+"plug/comment.asp?act=add&id="+infoid, data:data, error:function(){}, 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}); the.t0.value=""; the.send.disabled=false; break; case "2": $.message({type:"ok",content:info,time:2000}); the.t0.value=""; the.send.disabled=false; if($("#commenttop").length>0) { $.ajax( { type:"post", cache:false, url:webroot+"plug/comment.asp?act=load&id="+infoid, data:"", error:function(){}, success:function(_) { $("#commenttop").html(_); } }); } else { settimeout(function(){location.href=''+contenturl+'';},1500) } break; default: alert(_); break; } } }); return false }