PJBLOG中用到的ajaxjs.幾個(gè)簡(jiǎn)單的函數(shù)
更新時(shí)間:2007年12月01日 21:27:25 作者:
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) {//設(shè)置MiME類別
xmlhttp.overrideMimeType('text/xml');
}
}
return xmlhttp;
}
function getdata(url,obj1,obj2)
{
var xmlhttp=createxmlhttp();
if(!xmlhttp)
{
alert("你的瀏覽器不支持XMLHTTP!!");
return;
}
xmlhttp.onreadystatechange=requestdata;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
function requestdata()
{
fopen(obj1);
echo(obj1,"正在加載數(shù)據(jù),請(qǐng)稍等......");
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{
if(obj1!=obj2){fclose(obj1);};
echo(obj2,xmlhttp.responseText);
}
}
}
}
{
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) {//設(shè)置MiME類別
xmlhttp.overrideMimeType('text/xml');
}
}
return xmlhttp;
}
function getdata(url,obj1,obj2)
{
var xmlhttp=createxmlhttp();
if(!xmlhttp)
{
alert("你的瀏覽器不支持XMLHTTP!!");
return;
}
xmlhttp.onreadystatechange=requestdata;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
function requestdata()
{
fopen(obj1);
echo(obj1,"正在加載數(shù)據(jù),請(qǐng)稍等......");
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{
if(obj1!=obj2){fclose(obj1);};
echo(obj2,xmlhttp.responseText);
}
}
}
}
相關(guān)文章
AJAX獲取服務(wù)器當(dāng)前時(shí)間及時(shí)間格式輸出處理
本文整理了關(guān)于AJAX獲取服務(wù)器當(dāng)前時(shí)間的知識(shí),不會(huì)的朋友可以參考下哈,希望對(duì)你有所幫助2013-05-05SpringMVC+Jquery實(shí)現(xiàn)Ajax功能
SpringMVC:是基于Spring的一個(gè)子框架(MVC框架),功能強(qiáng)于Spring,這個(gè)框架主要是解決咱們Controller這一層的問(wèn)題。這篇文章主要介紹了SpringMVC+Jquery實(shí)現(xiàn)Ajax功能,需要的朋友可以參考下2019-06-06使用AJAX返回WebService里的集合具體實(shí)現(xiàn)
如何使用AJAX返回WebService里的集合,在本文將有一個(gè)完美的實(shí)現(xiàn),感興趣的朋友可以參考下哈,希望可以幫助到你2013-05-05Ajax局部刷新應(yīng)用案例---簡(jiǎn)單登錄
Ajax局部刷新在之前的文章中也有介紹過(guò),下面以一個(gè)登錄的例子為大家介紹下其具體的使用2013-12-12通過(guò)構(gòu)造AJAX參數(shù)實(shí)現(xiàn)表單元素JSON相互轉(zhuǎn)換
這篇文章主要介紹了通過(guò)構(gòu)造AJAX參數(shù)實(shí)現(xiàn)表單元素JSON相互轉(zhuǎn)換 的相關(guān)介紹,需要的朋友可以參考下2016-05-05國(guó)內(nèi)首發(fā) -- ajax完整功能框架
國(guó)內(nèi)首發(fā) -- ajax完整功能框架2007-01-01