婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁(yè) > 知識(shí)庫(kù) > 一個(gè)Ajax類

一個(gè)Ajax類

熱門標(biāo)簽:海南銀行智能外呼系統(tǒng)商家 遼寧銀行智能外呼系統(tǒng) 姜堰電銷機(jī)器人 電銷機(jī)器人違法了嗎 上海浦東騰訊地圖標(biāo)注位置 許昌智能電銷機(jī)器人公司 遼寧正規(guī)電銷機(jī)器人 辰溪地圖標(biāo)注 澳大利亞城市地圖標(biāo)注
程序代碼:
script type="text/javascript">
function Ajax(sUrl,sRecvTyp,sQueryString,oResultFunc) {
this.Url = sUrl;
this.QueryString = sQueryString;
this.XmlHttp = this.createXMLHttpRequest();
if (this.XmlHttp == null) {
alert("erro");
return;
}
var objxml = this.XmlHttp;
objxml.onreadystatechange = function (){Ajax.handleStateChange(objxml,sRecvTyp,oResultFunc)};
}

Ajax.prototype.createXMLHttpRequest = function() {
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {}
try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {}
try { return new XMLHttpRequest(); } catch(e) {}
return null;
}

Ajax.prototype.createQueryString = function () {
var queryString = this.QueryString;
return queryString;
}

Ajax.prototype.get = function () {
sUrl = this.Url;
var queryString = sUrl+"?timeStamp=" + new Date().getTime() + "" + this.createQueryString();
this.XmlHttp.open("GET",queryString,true);
this.XmlHttp.send(null);
}

Ajax.prototype.post = function() {
sUrl = this.Url;
var sUrl = sUrl + "?timeStamp=" + new Date().getTime();
var queryString = this.createQueryString();
this.XmlHttp.open("POST",sUrl,true);
this.XmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
this.XmlHttp.send(queryString);
}

Ajax.handleStateChange = function (XmlHttp,sRecvTyp,oResultFunc) {
if (XmlHttp.readyState == 4) {
if (XmlHttp.status == 200) {
oResultFunc(sRecvTyp?XmlHttp.responseXML:XmlHttp.responseText);
} else {
alert("您所請(qǐng)求的頁(yè)面有異常。");
}
}
}
/script>



使用方法:
script type="text/javascript">
var classAjax = new Ajax(sUrl,sRecvTyp,sQueryString,oResultFunc);
classAjax.post();//post方式發(fā)送數(shù)據(jù)
classAjax.get();//get方式發(fā)送數(shù)據(jù)
//sUrl發(fā)送地址
//sRecvTyp 接受數(shù)據(jù)類型:0為xml 1為text
//oResultFunc 返回結(jié)果處理函數(shù)
/script>

應(yīng)用實(shí)例:
script type="text/javascript">
var ajax1 = new Ajax("1.asp",0,"id="+id,bacal);
ajax1.post();
function bacal(rexm){
//返回?cái)?shù)據(jù)處理函數(shù);
}
/script>

標(biāo)簽:伊春 崇左 威海 晉城 西藏 撫州 銅川 深圳

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《一個(gè)Ajax類》,本文關(guān)鍵詞  一個(gè),Ajax,類,一個(gè),Ajax,類,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《一個(gè)Ajax類》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于一個(gè)Ajax類的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 抚州市| 津市市| 湾仔区| 西华县| 嘉定区| 安阳县| 六枝特区| 镇原县| 巴林右旗| 荥阳市| 建水县| 和顺县| 扬中市| 响水县| 南川市| 公安县| 丹东市| 望都县| 奎屯市| 渭源县| 定南县| SHOW| 贡嘎县| 乌拉特前旗| 宝丰县| 丰都县| 木里| 上林县| 垦利县| 怀仁县| 巴彦淖尔市| 双峰县| 宜宾县| 蓬莱市| 察雅县| 西丰县| 天台县| 建昌县| 波密县| 龙井市| 汕头市|