手机
当前位置:查字典教程网 >编程开发 >AJAX相关 >PJBLOG中用到的ajaxjs.几个简单的函数
PJBLOG中用到的ajaxjs.几个简单的函数
摘要:function$(id){returndocument.getElementById(id);}functionecho(obj,html...

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;

}

xmlhttp.onreadystatechange=requestdata;

xmlhttp.open("GET",url,true);

xmlhttp.send(null);

functionrequestdata()

{

fopen(obj1);

echo(obj1,"正在加载数据,请稍等......");

if(xmlhttp.readyState==4)

{

if(xmlhttp.status==200)

{

if(obj1!=obj2){fclose(obj1);};

echo(obj2,xmlhttp.responseText);

}

}

}

}

【PJBLOG中用到的ajaxjs.几个简单的函数】相关文章:

javascript ajax功能函数

用ajax自动加载blogjava和博客园的rss

ajax同步验证单号是否存在的方法

springmvc 发送ajax出现中文乱码的解决方法汇总

pjblog发表评论用的ajaxJS.js

基于ajax的简单搜索实现方法

一个简单的AJAX请求类

django中使用jquery ajax post数据出现403错误的解决办法(两种方法)

ajax传递多个参数具体实现

js与jQuery终止正在发送的ajax请求的方法

精品推荐
分类导航