document.write("好评率:- 差评率:-"); function sendhp() { $.get("http://www.e-huaxue.com/sendgoodbad.asp", { id: "970", gb: "g" }, function(data){ viewpp(data); }); } function viewpp(data) { if(data!="err") { var dpsj = data.split(","); var good = parseInt(dpsj[0]); var bad = parseInt(dpsj[1]); $("#hpp").html(GetPercent(good,good+bad)); $("#cpp").html(GetPercent(bad,good+bad)); } else { alert("只有下载此资料的会员可以发表评价!"); } } function GetPercent(num, total) { num = parseFloat(num); total = parseFloat(total); if (isNaN(num) || isNaN(total)) { return "-"; } return total <= 0 ? "-" : (Math.round(num / total * 10000) / 100.00 + "%"); } function sendcp() { $.get("http://www.e-huaxue.com/sendgoodbad.asp", { id: "970", gb: "b" }, function(data){ viewpp(data); }); }