`
447214075
  • 浏览: 78184 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

main.js

    博客分类:
  • js
 
阅读更多
function killErrors() {
    return true;
}
window.onerror = killErrors;

function visible_click() {
    if (td1.className == "") {

        td1.className = "tddisp";


    }
    else {
        td1.className = "";

    }

}


function useronline() {
    mytop = screen.availHeight - 500;
    myleft = 0;
    window.open("main.do?action=User_online", "online", "height=370,width=170,status=0,toolbar=no,menubar=no,location=no,top=" + mytop + ",left=" + myleft + ",resizable=yes");
}

function openpwd() {
    mytop = screen.availHeight - 500;
    myleft = 250;
    window.open("main.do?acrion=Update_pwd", "plugin", "height=250,width=350,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top=" + mytop + ",left=" + myleft + ",resizable=no");
}

function userall() {
    mytop = screen.availHeight - 500;
    myleft = 250;
    window.open("main.do?action=Update_Per", "online", "height=350,width=630,status=0,toolbar=no,menubar=no,location=no,top=" + mytop + ",left=" + myleft + ",resizable=no");
}
function usertx() {
    mytop = screen.availHeight - 500;
    myleft = 250;
    window.open("main.do?action=Updatetx", "plugin", "height=300,width=400,status=0,toolbar=no,menubar=no,location=no,top=" + mytop + ",left=" + myleft + ",resizable=yes");
}

function send_request(url) {
    http_request = false;
    if (window.XMLHttpRequest)//Mozilla 浏览器
    {
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType)//设置MiME类别
        {
            http_request.overrideMimeType("text/xml");
        }
    }
    else if (window.ActiveXObject)// IE浏览器
    {
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                http_request = new ActivexObject("Microsoft.XMLHTTP");
            }
            catch (e)
{ }
        }
    }
    if (!http_request)// 异常,创建对象实例失败
    {
        content.innerHTML = "不能创建XMLHttpRequest对象实例";
        //window.alert("不能创建XMLHttpRequest对象实例");
        return false;
    }
    //指定服务器返回信息时处理程序
    http_request.onreadystatechange = processRequest;
    // 确定发送请求的方式和URL以及是否同步执行下段代码
    http_request.open("GET", url, true);
    http_request.send(null);
}



function processRequest() {
    if (http_request.readyState == 4) {
        if (http_request.status == 200) {

            //content.innerHTML=http_request.responseText;

            if (http_request.responseText == 'notuser') {
                alert('登陆超时'); window.parent.location = 'login.do?action=Login'
            }
        }
        else {
            //window.parent.location = 'default.aspx'

            window.parent.location = 'login.do?action=Login'
            content.innerHTML = "您所请求的页面有异常。请重新登陆再试";
        }
    }
}


window.setInterval("send_request('main.do?action=User_online_update&tmp='+Math.random())", 300000);

function showCover() {
    //遮罩宽
    var sw = document.body.scrollWidth;
    //遮罩高
    var sh = document.body.scrollHeight;
    if (document.getElementById('AlexCoverV1_0')) {
        DispalySelect(0);
        document.getElementById('AlexCoverV1_0').style.display = 'block';
    }
    else {
        DispalySelect(0);
        var div = document.createElement("div");
        div.id = "AlexCoverV1_0";
        div.style.position = "absolute";
        div.style.top = "0px";
        div.style.left = "0px";
        div.style.height = sh + "px";
        div.style.width = sw + "px";
        div.style.background = "#ffffff";
        div.style.filter = "alpha(opacity=20)";
        document.body.appendChild(div);
    }
}

//显示和隐藏select控件
function DispalySelect(val) {
    var dispalyType;
    var arrdispalyType = ["hidden", "visible"];
    var arrObjSelect = document.getElementsByTagName("select");
    for (i = 0; i < arrObjSelect.length; i++) {
        arrObjSelect[i].style.visibility = arrdispalyType[val];
    }
}
function UploadComplete() {

    showCover();
    //控件宽
    var aw = 300;
    //控件高
    var ah = 80;
    //计算控件水平位置
    var al = (screen.width - aw) / 2;
    //计算控件垂直位置
    var at = (screen.height - ah) / 5;
    //内容管理
    var title = '';
    var icon = 'indi.gif';
    var cardID = '0';
    //输出提示框
    var div = document.createElement("div");
    div.id = "UploadChoose";
    div.innerHTML = '\
    <div style="background-color:#FFFFFF;position:absolute;top:' + at + 'px;left:' + al + 'px;width:' + aw + 'px;height:' + ah + 'px;border:2px solid #000000;text-align:center">\
        <div style="clear:both;background-color:#0099AA;line-height:25px;font-weight:bold;color:#FFFFFF;font-size:12px;padding-left:10px">' + title + '</div>\
        <div style="padding-top:30px;">\
        <div style="float:left;width:20px;padding-left:40px"><img src="resources/images/' + icon + '" alert"Cardo" /></div>\
       <div style="float:left;width:180px;margin-top:13px;padding-left:0px"><b>菜单加载中,请等待...</b></div>\
    <div style="clear:both;text-align:center;margin-top:10px;padding-bottom:10px">\
            </div>\
        </div>\
    </div>';
    document.body.appendChild(div);

}

function closeAlert(alertid) {
    document.getElementById(alertid).outerHTML = '';
    closeCover();
}
function closeCover() {
    if (document.getElementById('AlexCoverV1_0')) {
        document.getElementById('AlexCoverV1_0').style.display = 'none';
        DispalySelect(1);
    }
}


//弹出信息框
function showwin(url) {
    mytop = 100;
    myleft = 250;
    window.open(url, "online", "height=550,width=820,status=0,toolbar=no,menubar=no,location=no,top=" + mytop + ",left=" + myleft + ",resizable=no");
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics