var http_request = false; function CommentMakeRequest(url, functionName, httpType, sendData) { http_request = false; if (!httpType) httpType = "GET"; if (window.XMLHttpRequest) { // Non-IE... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/plain'); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { alert('Cannot send an XMLHTTP request'); return false; } var changefunc="http_request.onreadystatechange = "+functionName; eval (changefunc); //http_request.onreadystatechange = alertContents; http_request.open(httpType, url, true); http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); http_request.send(sendData); } //评论分页提交 function CommentToPage(page,p){ CommentMakeRequest('/e/extend/shoppl/pingjia.php?classid=122&id=358&doaction=&page='+page+'&t='+Math.random()+'&p='+p,'CommentReturnedText','GET',''); } //区分评价 function CommentTopj(a,pj){ $(".commentAll h3").removeClass("curr"); $(a).parent().addClass("curr"); CommentMakeRequest('/e/extend/shoppl/pingjia.php?classid=122&id=358&p='+pj+'&t='+Math.random(),'CommentReturnedText','GET',''); } //评论分页显示 function CommentReturnedText() { if(http_request.readyState == 4) { if(http_request.status == 200) { var messagereturn = http_request.responseText; if(messagereturn!='isfail') { var r; r=messagereturn.split(''); if(r.length!=1) { if(r[0]!='') { $(".comment-total-sf").text(r[0]); } document.getElementById('comment-lists-sf').innerHTML=r[1]; $("#positive-num-sf,#user-comment-sf").text(r[2]); $(".commentAll h3:eq(0) a font").text("("+r[0]+")"); $(".commentAll h3:eq(1) a font").text("("+r[3]+")"); $(".commentAll h3:eq(2) a font").text("("+r[4]+")"); $(".commentAll h3:eq(3) a font").text("("+r[5]+")"); $(".commentAll h3:eq(4) a font").text("("+r[6]+")"); $("#positive-sf").css("width",r[2]+"%"); if(r[0]!="0"){ $("#sorce-star-sf dl:eq(0) .pBar div").css("width",parseInt(r[3]/r[0]*100)+"%"); $("#sorce-star-sf dl:eq(0) dd:eq(1)").text(parseInt(r[3]/r[0]*100)+"%"); $("#sorce-star-sf dl:eq(1) .pBar div").css("width",parseInt(r[4]/r[0]*100)+"%"); $("#sorce-star-sf dl:eq(1) dd:eq(1)").text(parseInt(r[4]/r[0]*100)+"%"); $("#sorce-star-sf dl:eq(2) .pBar div").css("width",parseInt(r[5]/r[0]*100)+"%"); $("#sorce-star-sf dl:eq(2) dd:eq(1)").text(parseInt(r[5]/r[0]*100)+"%"); } $("#bestComment-sf dd div").html(r[6]); } else { document.getElementById('comment-lists-sf').innerHTML=messagereturn; } } } else { alert('There was a problem with the request.'); } } } //首页 CommentToPage(0);