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){
CommentMakeRequest('/e/extend/infocomment/?classid=1222&id=202542&doaction=&page='+page+'&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]=="0")
{
//$("#detail-empty-comment").show();
//document.getElementById('infocommentnumarea').innerHTML=r[0];
$(".commentcon").html('');
} else {
$(".commentcon").html(r[1]);
}
if(r[2]==r[3]){
$(".more-comment").hide();
}
if(r[3]>r[2]){
$(".more-comment").show();
}
if(r[2]==r[3] && r[3]>0){
$(".view-more-text").html("没有更多评论了");
$(".view-more-text").addClass("disabled");
}
}
else
{
$("#detail-all-comment-title").hide();
$("#detail-empty-comment").show();
//$(".commentcon").html(messagereturn);
}
}
}
else
{
alert('There was a problem with the request.');
}
}
}
//首页
CommentToPage(0);