var xmlHttp; var addNew; var infoidpl function GetXmlHttpObject(handler) { var objXmlHttp=null if (navigator.userAgent.indexOf("MSIE")>=0) { var strName="Msxml2.XMLHTTP" if (navigator.appVersion.indexOf("MSIE 5.5")>=0) { strName="Microsoft.XMLHTTP" } try { objXmlHttp=new ActiveXObject(strName) objXmlHttp.onreadystatechange=handler return objXmlHttp } catch(e) { alert("Error. Scripting for ActiveX might be disabled") return } } else { objXmlHttp=new XMLHttpRequest() objXmlHttp.onload=handler objXmlHttp.onerror=handler return objXmlHttp } } /* 显示留言 */ function showre(id,no) { document.getElementById("list").innerHTML = ""; var url = "/Ping.asp?id="+id+"&page="+no; xmlHttp=GetXmlHttpObject(showlist) xmlHttp.open("GET", url , true) xmlHttp.send(null) } function showlist() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("list").innerHTML = "" xmlIDN = xmlHttp.responseXML.getElementsByTagName("IDN") xmlAuthor = xmlHttp.responseXML.getElementsByTagName("Author") xmlContent = xmlHttp.responseXML.getElementsByTagName("Content") xmlNoI = xmlHttp.responseXML.getElementsByTagName("NoI") xmlIP = xmlHttp.responseXML.getElementsByTagName("IP") xmlmd1 = xmlHttp.responseXML.getElementsByTagName("md1") xmlmd2 = xmlHttp.responseXML.getElementsByTagName("md2") xmlreContent = xmlHttp.responseXML.getElementsByTagName("reContent") //输出评论 for (i=0;i< xmlContent.length;i++) { var Content = xmlContent[i].firstChild.data; var div = document.createElement("DIV"); div.id = i; if (Content == "没有评论") { //alert(1) div.innerHTML = "
暂时还没有评论
" } else { var Author = xmlAuthor[i].firstChild.data; var Content = xmlContent[i].firstChild.data; var PostTime = xmlAuthor[i].getAttribute('PostTime'); var IDN = xmlIDN[i].firstChild.data; var ID = xmlNoI[i].firstChild.data; var md1 = xmlmd1[i].firstChild.data; var md2 = xmlmd2[i].firstChild.data; var IP = xmlIP[i].firstChild.data; var reContent = xmlreContent[i].firstChild.data; if (get_cookiepl(IDN)!=IDN){ div.innerHTML = "
"+ID+" 楼:
"+Author+"
来自:"+IP+"
发表于 "+PostTime+"

"+Content+"
"+reContent+"
" } else { div.innerHTML = "
"+ID+" 楼:
"+Author+"
来自:"+IP+"
发表于 "+PostTime+"

"+Content+"
"+reContent+"
" } } document.getElementById("list").appendChild(div); } var page = xmlHttp.responseXML.getElementsByTagName("data")[0].getAttribute('page'); var ID = xmlHttp.responseXML.getElementsByTagName("data")[0].getAttribute('ID'); var D_Nums = xmlHttp.responseXML.getElementsByTagName("data")[0].getAttribute('D_Nums'); if (Content == "没有评论") { document.getElementById('commentframe').innerHTML = D_Nums; } else { document.getElementById('commentframe').innerHTML = D_Nums; if(document.getElementById('commentframeB')) { document.getElementById('commentframeB').innerHTML = D_Nums; } } //输出分页信息 P_Nums = xmlHttp.responseXML.getElementsByTagName("data")[0].getAttribute('P_Nums'); if (P_Nums>1) { var l1 = "共"+D_Nums+"条评论 "+page+"/"+P_Nums+" " l1 = (page>1)?l1+"<< ":l1; var l2 = ""; for (var i =1;i<=P_Nums;i++) { l2 += (i == page)?""+i+"":""+i+"" } l2 = (page == P_Nums)?l2:l2+">> " document.getElementById("MultiPage").innerHTML = l1+l2; } } } /* 发送留言 */ function AddNew() { document.getElementById("sendGuest").disabled = true; var Author = escape(document.getElementById("memAuthor").value); var Content = escape(document.getElementById("memContent").value); var ArticleID = escape(document.getElementById("ArticleID").value); if (Author == "" || Content == "") { alert("请填写完整!"); document.getElementById("sendGuest").disabled = false; return false; } addNew = GetXmlHttpObject(sendGuest); var GuestInfo = "Author="+Author+"&ArticleID="+ArticleID+"&Content="+Content; addNew.open("POST","/AddNew.asp",false); addNew.setRequestHeader("Content-Type","application/x-www-form-urlencoded") addNew.send(GuestInfo); } function sendGuest() { if (addNew.readyState==4 || addNew.readyState=="complete") { if(unescape(addNew.responseText)!='') {alert(unescape(addNew.responseText));} document.getElementById("sendGuest").disabled = false; //document.getElementById("memAuthor").value = ""; document.getElementById("memContent").value = ""; showre(document.getElementById("ArticleID").value,1); } } function reSet() { document.getElementById("memAuthor").value = ""; document.getElementById("memContent").value = ""; } function getmoodpl(infoid,mood_id) { infoidpl=infoid; //if(moodztpl == "1") if (get_cookiepl(infoidpl)==infoidpl) { alert("-_-|||,本条评论您已经表态过了!"); } else { url = "http://"+window.location.host+"/xinqinglist.asp?action=mood&id="+infoid+"&typee="+mood_id+"&m=" + Math.random(); makeRequestpl(url,'return_reviewpl','GET',''); //moodztpl = "1"; addCookie(infoidpl,infoidpl,1) no="1"; alert("投票成功!"); } } function addCookie(name,value,expiresHours) { var cookieString=name+"="+escape(value); //判断是否设置过期时间 if(expiresHours>0){ var today = new Date(); var expires = new Date(); expires.setTime(today.getTime()+expiresHours*24*3600*1000); cookieString=cookieString+"; expires="+expires.toGMTString(); } document.cookie=cookieString; } function makeRequestpl(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 $() { var elements = new Array(); for (var i = 0; i < arguments.length; i++) { var element = arguments[i]; if (typeof element == 'string') element = document.getElementById(element); if (arguments.length == 1) return element; elements.push(element); } return elements; } function get_cookiepl(Name) { var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) if (offset != -1) { offset += search.length end = document.cookie.indexOf(";", offset); if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(offset, end)) } } return returnvalue; } function remoodpl() { url = "http://"+window.location.host+"/xinqinglist.asp?action=show&id="+infoid+"&m=" + Math.random(); makeRequestpl(url,'return_reviewpl','GET',''); } function return_reviewpl(ajax) { if (http_request.readyState == 4) { if (http_request.status == 200) { var str_error_num = http_request.responseText; if(str_error_num=="error") { alert("信息不存在!"); } else if(str_error_num==0) { alert("-_-|||,本条评论您已经表态过了!"); } else { moodinnerpl(str_error_num); } } else { alert('Error'); } } } function moodinnerpl(moodtext) { var imga = "images/pre_02.gif"; var imgb = "images/pre_01.gif"; var color1 = "#666"; var heightz = "80"; //图片100%时的高 var hmax = 0; var hmaxpx = 0; var heightarr = new Array(); var moodarr = moodtext.split(","); var moodzs = 0; for(k=0;k<2;k++) { moodarr[k] = parseInt(moodarr[k]); moodzs += moodarr[k]; } for(i=0;i<2;i++) { heightarr[i]= Math.round(moodarr[i]/moodzs*heightz); if(heightarr[i]<1) heightarr[i]=1; if(moodarr[i]>hmaxpx) { hmaxpx = moodarr[i]; } } for(j=0;j<2;j++) { if(moodarr[j]==hmaxpx && moodarr[j]!=0) { document.getElementById("md"+j+infoidpl).innerHTML = "支持("+moodarr[j]+")"; } else { document.getElementById("md"+j+infoidpl).innerHTML = "反对("+moodarr[j]+")"; } } }