java多线程    Java入门    vsftp    ftp    linux配置    centos    FRP教程    HBase    Html5缓存    webp    zabbix    分布式    neo4j图数据库    

改写系统alert的弹出浮层的JS

//改写alert  
window.alert = function(txt)  
{  
    var borderColor = "#999";
    var title = "[月小升博客提示]";
    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 = document.body.scrollHeight+"px";  
    shield.style.background = "#333";  
    shield.style.textAlign = "center";  
    shield.style.zIndex = "10000";  
    shield.style.filter = "alpha(opacity=0)";  
    var alertFram = document.createElement("DIV");  
    alertFram.id="alertFram";  
    alertFram.style.position = "absolute";  
    alertFram.style.left = "50%";  
    alertFram.style.top = "50%";  
    alertFram.style.marginLeft = "-225px";  
    alertFram.style.marginTop = "-75px";  
    alertFram.style.width = "450px";  
    alertFram.style.height = "150px";  
    alertFram.style.background = "#ccc";  
    alertFram.style.textAlign = "center";  
    alertFram.style.lineHeight = "150px";  
    alertFram.style.zIndex = "10001";  
    strHtml = "
    \n"; strHtml += "
  • "+title+"
  • \n"; strHtml += "
  • "+txt+"
  • \n"; strHtml += "
  • \n"; strHtml += "
\n"; alertFram.innerHTML = strHtml; document.body.appendChild(alertFram); document.body.appendChild(shield); var c = 0; this.doAlpha = function(){ if (c++ > 20){clearInterval(ad);return 0;} shield.style.filter = "alpha(opacity="+c+");"; } var ad = setInterval("doAlpha()",5); this.doOk = function(){ alertFram.style.display = "none"; shield.style.display = "none"; } alertFram.focus(); document.body.onselectstart = function(){return false;}; }

调用页面改写系统的alert





  

姓名:

效果


This entry was posted in WEB前端 and tagged , . Bookmark the permalink.
月小升QQ 2651044202, 技术交流QQ群 178491360
首发地址:月小升博客https://java-er.com/blog/js-alert-change-system/
无特殊说明,文章均为月小升原创,欢迎转载,转载请注明本文地址,谢谢
您的评论是我写作的动力.

Leave a Reply