<SCRIPT src="ajax_about.js"></SCRIPT>
<!--显示-创建html文档。无刷新技术 -->
<DIV id=my_div></DIV>
<SCRIPT>
var curObject = document.getElementById("my_div");
createhtml("show.asp",curObject); //这里可以调用asp文件与PHP、.Net
</SCRIPT>
<!--显示-创建html文档。无刷新技术 -->
===========================================================================
<!--ajax的js代码可换gb2312 to utf8 下面是泛微OA中的ajax代码 --->
<SCRIPT LANGUAGE="JavaScript">
<!--
var loadStr = '<table width="100%" height="50%" border="0" cellpadding="0"><tr><td align="center"><img src="loading.gif"><div style="background-color:#f7f7f7;200px;height:20px;padding:5px;border:1px solid #CCCCCC;">正在处理请稍后...</div></td></tr></table>';
function gb2utf8(data){
var glbEncode = [];
gb2utf8_data = data;
execScript("gb2utf8_data = MidB(gb2utf8_data, 1)", "VBScript");
var t=escape(gb2utf8_data).replace(/%u/g,"").replace(/(.{2})(.{2})/g,"%$2%$1").replace(/%([A-Z].)%(.{2})/g,"@$1$2");
t=t.split("@");
var i=0,j=t.length,k;
while(++i<j) {
k=t[i].substring(0,4);
if(!glbEncode[k]) {
gb2utf8_char = eval("0x"+k);
execScript("gb2utf8_char = Chr(gb2utf8_char)", "VBScript");
glbEncode[k]=escape(gb2utf8_char).substring(1,6);
}
t[i]=glbEncode[k]+t[i].substring(4);
}
gb2utf8_data = gb2utf8_char = null;
return unescape(t.join("%"));
}
var prefixes = ["MSXML2.XmlHttp","Microsoft.XmlHttp","MSXML3.XmlHttp", "MSXML.XmlHttp"];
function getDomObject(){
for (var i = 0; i < prefixes.length; i++) {
try{xmlHttp = new ActiveXObject(prefixes[i]);}catch(ex){};
}
return xmlHttp;
}
function createhtml(strUrl,objDiv){
objDiv.innerHTML = loadStr;
var Element= this;
var xmlHttp = getDomObject();
xmlHttp.open("GET",strUrl, true);
xmlHttp.onreadystatechange = function () {
switch (xmlHttp.readyState) {
case 3 :
objDiv.innerHTML = loadStr;
break;
case 4 :
if (xmlHttp.status == 200){
objDiv.innerHTML=gb2utf8(xmlHttp.responseBody);
}
}
}
xmlHttp.setRequestHeader("Content-Type","text/xml")
xmlHttp.send(null);
}
//-->
</SCRIPT>