zoukankan      html  css  js  c++  java
  • 手机重写alert方法(去除网址和关闭网页按钮)

    js代码

    /*重写alert方法*/
    	 	window.alert = function(str)
    		{
    		    
    		    var alertFram = document.createElement("DIV");
    		    alertFram.id="alertFram";
    		    alertFram.style.position = "fixed";
    		    alertFram.style.width = "100%";
    		    alertFram.style.height = "100%";
    		    alertFram.style.top = "0";
    		    alertFram.style.textAlign = "center";
    		    alertFram.style.lineHeight = "150px";
    		    alertFram.style.zIndex = "300";
    		    alertFram.style.backgroundColor="rgba(0, 0, 0, 0.58)";
    		    alertFram.style.fontSize="12px";
    		    strHtml = '<ul class="alert_ul">';
    		    strHtml += '<li class="alert_content">'+str+'</li>';
    		    strHtml += '<li class="alert_btn-wrap"><a type="button" value="确定" onclick="doOk()" class="alert_btn">确定</a></li>';
    		    strHtml += '</ul>';
    		    alertFram.innerHTML = strHtml;
    		    document.body.appendChild(alertFram);
    		    this.doOk = function(){
    		        alertFram.style.display = "none";
    		    }
    		}
    

      css渲染

    .alert_ul{list-style:none;margin:0px;padding:0px;width:70%;margin: auto;margin-top: 53%;}
    .alert_title{background:#F2F2F2;text-align:left;padding-left:20px;line-height:60px;border:1px solid #999;}
    .alert_content{background:#fff;text-align:center;height:80px;line-height:80px;}
    .alert_btn-wrap{background:#fff;text-align:center;height:30px;line-height:18px;}
    .alert_btn{cursor:pointer;color:#2bd00f;}

    使用方法:

      加入css和js,直接编写;

    alert("推荐失败,请重新操作。");
    

      

    /*重写alert方法*/ window.alert = function(str){        var alertFram = document.createElement("DIV");    alertFram.id="alertFram";    alertFram.style.position = "fixed";    alertFram.style.width = "100%";    alertFram.style.height = "100%";    alertFram.style.top = "0";    alertFram.style.textAlign = "center";    alertFram.style.lineHeight = "150px";    alertFram.style.zIndex = "300";    alertFram.style.backgroundColor="rgba(0, 0, 0, 0.58)";    alertFram.style.fontSize="12px";    strHtml = '<ul class="alert_ul">';    strHtml += '<li class="alert_content">'+str+'</li>';    strHtml += '<li class="alert_btn-wrap"><a type="button" value="确定" onclick="doOk()" class="alert_btn">确定</a></li>';    strHtml += '</ul>';    alertFram.innerHTML = strHtml;    document.body.appendChild(alertFram);    this.doOk = function(){        alertFram.style.display = "none";    }}

  • 相关阅读:
    Hadoop命令手册
    HDFS配额管理指南
    HDFS权限管理用户指南
    Hadoop分布式文件系统使用指南
    Hadoop分布式文件系统:架构和设计
    ImageLoader 图片加裁
    发送 一个无序广播
    Intent 转向
    Volley Get Post 方法
    Android 动态设置控件宽高度
  • 原文地址:https://www.cnblogs.com/important/p/7656876.html
Copyright © 2011-2022 走看看