通过本文主要向大家介绍了pjblog发表评论用的ajaxJS.js等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
document.write('<DIV id="loadingg" style="HEIGHT:65px; WIDTH: 200px;POSITION: absolute; Z-INDEX:1000;border:3px;solid;text-align:center;sans-serif;color:#000000;background-color:#FFFFFF;opacity:.7;-moz-opacity:.7;filter: Alpha(Opacity=75, FinishOpacity=50, Style=1, StartX=0, StartY=1, FinishX=200, FinishY=100); display:none;"><br/><font color="#708090"><b>数据正在读取中,请等候...</b></font><br/><img src="images/loading.gif"/></DIV>')
function showloading()
{
var obj=document.getElementById("loadingg")
if (obj.style.display!="")
{
obj.style.left=((document.documentElement.clientWidth-parseFloat (obj.style.width))/2)+document.documentElement.scrollLeft+"px";
obj.style.top=((document.documentElement.clientHeight-parseFloat (obj.style.height))/2)+document.documentElement.scrollTop+"px";
obj.style.display="";
}else{obj.style.display="none";}
}
function $(id)
{
return document.getElementById(id);
}
function echo(obj,html)
{
$(obj).innerHTML=html;
}
function fopen(obj)
{
$(obj).style.display="";
}
function fclose(obj)
{
$(obj).style.display="none";
}
function createxmlhttp()
{
var xmlhttp=false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
if (xmlhttp.overrideMimeType) {//设置MiME类别
xmlhttp.overrideMimeType('text/xml');
}
}
return xmlhttp;
}
function getdata(url,obj1,obj2)
{
var xmlhttp=createxmlhttp();
if(!xmlhttp)
{
alert("你的浏览器不支持XMLHTTP!!");
return;
}
showloading()
xmlhttp.onreadystatechange=requestdata;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
function requestdata()
{
fopen(obj1);
//echo(obj1,"正在加载数据,请稍等......");
//alert(xmlhttp.readyState)
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{
if(obj1!=obj2){fclose(obj1);};
echo(obj2,xmlhttp.responseText);
showloading()
}
}
}
}
function postdata(url,obj,data)
{ var rnd=Math.random()
var xmlhttp=createxmlhttp();
if(!xmlhttp)
{
alert("你的浏览器不支持XMLHTTP!!");
return;
}
showloading()
xmlhttp.open("POST", url, true);
xmlhttp.onreadystatechange=requestdata;
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.send(data);
function requestdata()
{
fopen(obj);
echo(obj,"正在提交数据,请稍等......");
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{
echo(obj,xmlhttp.responseText);
reget(rnd);