JS 生成屏蔽層

来源:互联网 发布:淘宝咸鱼会不会被骗 编辑:程序博客网 时间:2024/05/29 08:55

var basealert=window.alert;
window.alert = function(txtString) {
    if (Const_DisplayAlertBG == "1") {
        var shield = document.createElement("DIV");
        //shield.id = "shield";
        shield.style.position = "absolute";
        shield.style.left = "0px";
        shield.style.top = "0px";
        shield.style.width = "100%";
        shield.style.height = "100%";
       
        shield.style.textAlign = "center";
        shield.style.zIndex = "10000";
        shield.style.filter = "alpha(opacity=50)";
        document.body.appendChild(shield);
        basealert(txtString);
        document.body.removeChild(shield);
       
    } else {
        basealert(txtString);
    }
}

原创粉丝点击