pjblog发表评论用的ajaxJS.js

亲人是父母给你找的朋友,朋友是你给自己找的亲人,所以同等重要,孰轻孰重没那么多分别。

document.write('<DIVid="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/><fontcolor="#708090"><b>数据正在读取中,请等候...</b></font><br/><imgsrc="images/loading.gif"/></DIV>')
functionshowloading()
{
varobj=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)
{
returndocument.getElementById(id);
}
functionecho(obj,html)
{
$(obj).innerHTML=html;
}
functionfopen(obj)
{
$(obj).style.display="";
}
functionfclose(obj)
{
$(obj).style.display="none";
}
functioncreatexmlhttp()
{
varxmlhttp=false;
try{
xmlhttp=newActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
xmlhttp=newActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
xmlhttp=false;
}
}
if(!xmlhttp&&typeofXMLHttpRequest!='undefined'){
xmlhttp=newXMLHttpRequest();
if(xmlhttp.overrideMimeType){//设置MiME类别
xmlhttp.overrideMimeType('text/xml');
}
} returnxmlhttp;
} functiongetdata(url,obj1,obj2)
{
varxmlhttp=createxmlhttp();
if(!xmlhttp)
{
alert("你的浏览器不支持XMLHTTP!!");
return;
}
showloading()
xmlhttp.onreadystatechange=requestdata;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
functionrequestdata()
{ 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()
}
} }
}
functionpostdata(url,obj,data)
{varrnd=Math.random()
varxmlhttp=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);
functionrequestdata()
{
fopen(obj);
echo(obj,"正在提交数据,请稍等......");
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{
echo(obj,xmlhttp.responseText);
reget(rnd);
setTimeout("echo('showresult','')",2000);
echo('Message','')
showloading()
}
}
}
}
functionlTrim(str)
{
if(str.charAt(0)=="")
{
//如果字串左边第一个字符为空格
str=str.slice(1);//将空格从字串中去掉
//这一句也可改成str=str.substring(1,str.length);
str=lTrim(str);//递归调用
}
returnstr;
} //去掉字串右边的空格
functionrTrim(str)
{
variLength; iLength=str.length;
if(str.charAt(iLength-1)=="")
{
//如果字串右边第一个字符为空格
str=str.slice(0,iLength-1);//将空格从字串中去掉
//这一句也可改成str=str.substring(0,iLength-1);
str=rTrim(str);//递归调用
}
returnstr;
} //去掉字串两边的空格
functiontrim(str)
{
returnlTrim(rTrim(str));
} functionf(obj)
{
returntrim(eval("document.ajax_post."+obj+".value"));
//returntrim($(obj).value);
} functionSaveReply()
{
if(f("username")=="")
{
alert("请填写用户名");
returnfalse;
}
if(f("Message")=="")
{
alert("内容不可為空");
returnfalse;
}
varvalidate,password,log_DisKey=0,log_DisURL=0,log_DisSM=0
validate=""
password=""
if(document.ajax_post.log_DisKey.checked){
log_DisKey=f("log_DisKey")
}
if(document.ajax_post.log_DisURL.checked){
log_DisURL=f("log_DisURL")
}
if(document.ajax_post.log_DisSM.checked){
log_DisSM=f("log_DisSM")
}
if((typeofeval(document.ajax_post.validate))!="undefined"){
if(f("validate")=="")
{
alert("请填写验证码");
returnfalse;
}else{
validate=f("validate");
}
}
if((typeofeval(document.ajax_post.password))!="undefined"){
password=f("password");
}
data="username="+escape(f("username"))+"&password="+escape(password)+"&validate="+escape(validate)+"&log_DisSM="+escape(log_DisSM)+"&log_DisURL="+escape(log_DisURL)+"&log_DisKey="+escape(log_DisKey)+"&Message="+escape(f("Message"))+"&logID="+escape(f("logID"))+"&action="+escape(f("action"));
//alert(data);
postdata("wbc_blogcomm.asp","showresult",data);
returntrue;
}

以上就是pjblog发表评论用的ajaxJS.js。与狼共舞,必须自己成为狼,而且变成“超级狼”。更多关于pjblog发表评论用的ajaxJS.js请关注haodaima.com其它相关文章!

以下您可能有感兴趣的文章:
标签: pjblog ajaxJS