alert.js

来自「漂亮的alert想用的话」· JavaScript 代码 · 共 44 行

JS
44
字号
AUIAlert=function(msg,name,fun,type,overFlow){
        if(document.getElementById("AUIAlertBtu")){
            document.getElementById("GlobleAUIAlertMsg").innerHTML = msg;
            if(typeof fun!="function"){fun = function(){}}
            document.getElementById("AUIAlertClose").onclick = function(){AUI("#AUIALayDiv").fadeOut(300);document.getElementById("AUIAlertClose").onclick=null;document.getElementById("AUIAlertBtu").onclick = null;AUI("#AUIAlterDiv").fadeOut(300);AUI("#AUIAlterDiv").remove();fun();}
            document.getElementById("AUIAlertBtu").onclick = function(){document.body.onresize=null;AUI("#AUIALayDiv").fadeOut(300);AUI("#AUIAlterDiv").fadeOut(300);AUI("#AUIAlterDiv").remove();fun();};
        }else{
            name = _ok_;// LL
            var imgtype = type||'222';
            if(typeof msg=="undefined"){msg = 'AvePoint Alert !';}
            if(typeof fun!="function"){fun = function(){}}
            if(!AUI("#AUIALayDiv").get(0)){AUI("body").append('<div id="AUIALayDiv" align="left" style="display:none;"></div>');}
            AUI("#AUIALayDiv").css("width",AUI.WH()[0]);
            AUI("#AUIALayDiv").css("height",AUI.WH()[1]);
            AUI("#AUIALayDiv").css("opacity","0.5");
            AUI("#AUIALayDiv").css("zIndex",9000);
            var html = new Array();
            html[html.length]='<div id="AUIAlterDiv" style="width:450px;" align="left" >\n';
    	    html[html.length]='<div style="width:450px;height:25px;background:url('+AUI.getWebRoot()+'/AUI/img/111.png)" align="left">';
    	    html[html.length]='<span style="color:white;font-family:Arial;font-size:17px;width:420px;padding-left:13px;font-weight:600;margin-top:3px">DocAve</span>';
    	    html[html.length]='<span style="position:relative;top:3px;cursor:hand"><img id="AUIAlertClose" src="'+AUI.getWebRoot()+'/AUI/img/cross_01.png" onmouseover="AUIAlertImgEvt(this,\'over\');" onmouseout="AUIAlertImgEvt(this,\'out\');"/></span>';
    	    html[html.length]='</div>';
    	    html[html.length]='<div style="height:100px;width:450px;">';
    	    html[html.length]='<span style="float:left;margin:10px 0px 0px 10px;"><img src="'+AUI.getWebRoot()+'/AUI/img/'+imgtype+'.png"/></span>';
    	    var overF = overFlow||'auto';
    	    html[html.length]='<span id="GlobleAUIAlertMsg" style="float:left;width:340px;height:70px;margin:30px 20px 0px 10px;font-family:Arial;font-weight:600;font-size:14px;color:#3594FE;overflow:'+overF+';scrollbar-face-color: #B8D7FF;scrollbar-shadow-color: #9FB5D2;scrollbar-highlight-color: #B8CBF6;scrollbar-3dlight-color: #FFFFFF;scrollbar-darkshadow-color:#9FB5D2;scrollbar-track-color: #EDF5FF;scrollbar-arrow-color: #2222DB;">'+msg+'</span>';
    	    html[html.length]='</div>';
    	    html[html.length]='<div style="padding-left:300px;padding-bottom:6px"><span><button id="AUIAlertBtu">&nbsp;'+name+'&nbsp;</button></span></div>';
    	    html[html.length]='</div>';
            html = html.join('');
        	AUI("body").append(html);AUI("#AUIALayDiv").fadeIn(300);AUI("#AUIAlterDiv").fadeIn(300);AUI("#AUIAlertBtu").AUIForm();
        	document.getElementById("AUIAlertBtu").focus();
            // document.onkeydown = function(e){var evt = e ||
			// window.event;if(evt.keyCode==13||evt.keyCode==27||evt.keyCode==32){AUI("#AUIAlertBtu").click();};return
			// false;}

        	document.body.onresize = function(){
        		function(){AUI("#AUIALayDiv").css("width",AUI.WH()[0]);AUI("#AUIALayDiv").css("height",AUI.WH()[1]);};
            };

            document.getElementById("AUIAlertClose").onclick = function(){AUI("#AUIALayDiv").fadeOut(300);document.getElementById("AUIAlertClose").onclick=null;document.getElementById("AUIAlertBtu").onclick = null;AUI("#AUIAlterDiv").fadeOut(300);AUI("#AUIAlterDiv").remove();fun();}
            document.getElementById("AUIAlertBtu").onclick = function(){document.body.onresize=null;AUI("#AUIALayDiv").fadeOut(300);AUI("#AUIAlterDiv").fadeOut(300);AUI("#AUIAlterDiv").remove();fun();};
        }
     },

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?