鉴于大家对Ajax十分关注,我们编辑小组在此为大家搜集整理了“MPBrowser简易图片浏览器 v1.0”一文,供大家参考学习
MPBrowser.js
复制代码 代码如下:
var thisImgNo = 290;
function ajaxConn(){
var xmlhttp = false;
try{xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){try{xmlhttp = new XMLHttpRequest();}
catch(e){alert(e);xmlhttp = false;}}}
if(!xmlhttp)return null;
this.connect = function(Url,Method,postContent){
if(!xmlhttp)return false;
Method = Method.toUpperCase();
try{
if (Method == "GET"){
xmlhttp.open(Method,Url + ''?'' + postContent,true);
xmlhttp.setRequestHeader("Content-Type","text/html;charset=GB2312");
sVars = null;
}else{
xmlhttp.open(Method,Url,true);
xmlhttp.setRequestHeader("Method","POST "+Url+" HTTP/1.1");
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
}
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState == 4){
if(xmlhttp.status == 200){
imgInfo = xmlhttp.ResponseText;
var imgInfoArr = imgInfo.split("|");
var tmpimg