首页 > 开发 > AJAX > 正文

MPBrowser简易图片浏览器 v1.0

2024-09-01 08:29:58
字体:
来源:转载
供稿:网友
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 = new Image();
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表