zoukankan      html  css  js  c++  java
  • 重写Alert和confirm方法去除地址显示

    //重写alert方法,去掉地址显示
    window.alert = function(name){
    var iframe = document.createElement("IFRAME");
    iframe.style.display="none";
    iframe.setAttribute("src", 'data:text/plain,');
    document.documentElement.appendChild(iframe);
    window.frames[0].window.alert(name);
    iframe.parentNode.removeChild(iframe);
    }

    //重写confirm方法,去掉地址显示
    window.confirm = function(name){
    var iframe = document.createElement("IFRAME");
    iframe.style.display="none";
    iframe.setAttribute("src", 'data:text/plain,');
    document.documentElement.appendChild(iframe);
    var result = window.frames[0].window.confirm(name);
    iframe.parentNode.removeChild(iframe);
    return result;
    }

  • 相关阅读:
    每日一题
    每日一题
    每日一题
    每日一题
    GitLab 部署
    Golang Web开发之Gin入门
    Golang消息队列之NSQ
    Golang操作Redis
    Golang操作MySQL
    Golang Json数据处理方法
  • 原文地址:https://www.cnblogs.com/stubborn-donkey/p/7243791.html
Copyright © 2011-2022 走看看