<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=320,initial-scale=1,maximum-scale=1,user-scalable=no" servergenerated="true" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta content="telephone=no" name="format-detection" />
</head>
<body></body>
</html>
<script>
//改写alert
window.alert = function(txt)
{
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.background = "#333";
shield.style.textAlign = "center";
shield.style.zIndex = "19901000";
shield.style.filter = "alpha(opacity=.5)";
shield.style.opacity = ".5";
var alertFram = document.createElement("DIV");
alertFram.id="alertFram";
alertFram.style.position = "absolute";
alertFram.style.left = "25%";
alertFram.style.top = "35%";
alertFram.style.width = "50%";
alertFram.style.background = "#ccc";
alertFram.style.overflow = "hidden";
alertFram.style.textAlign = "center";
alertFram.style.borderRadius = "5px";
alertFram.style.zIndex = "19901024";
strHtml = "<ul style=\"list-style:none;margin:0px;padding:0px;width:100%\">\n";
strHtml += " <li style=\"background:#FFFFFF;font-size:16px;text-align:center;height:30px;line-height:30px;border-bottom: 1px solid #EBEBEB;\">提 示</li>\n";
strHtml += " <li style=\"padding:20px;background:#fff;text-align:center;font-size:12px;border-bottom: 1px solid #EBEBEB;\">"+txt+"</li>\n";
strHtml += " <li style=\"background:#FFFFFF;text-align:center;font-size:14px;height:30px;line-height:30px;\"><span onclick=\"doOk()\" style=\"width: 50%;cursor: pointer;\">确 定</span></li>\n";
strHtml += "</ul>\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+")";
shield.style.opacity = ".5";
}
var ad = setInterval("doAlpha()",5);
this.doOk = function(){
//alertFram.style.display = "none";
//shield.style.display = "none";
     document.body.removeChild(alertFram);
document.body.removeChild(shield);
    }
alertFram.focus();
document.body.onselectstart = function(){return false;};
}
alert(1);
</script>

js alert重写,适用于手机端,改自于网上的代码的更多相关文章

  1. JS 判断是否是手机端并跳转操作

    JS 判断运行当前脚本的应用程序是否为手机端或者一些其他信息,在我的工作中遇到的不是十分频繁,被我的同事一问就给问住了,所以把之前找到的一些知识点整理出来,供大家参考,若哪里不对欢迎指出,我会及时的更 ...

  2. js判断是否为手机端访问

    随着移动端越来越重要,pc和移动端网站后台系统可能是同一个,登录或者某个特定时期需要根据不同访问来源,跳转不同页面或者做不同的处理: 这时我们就需要js的 navigator 对象: 我们先了解一下n ...

  3. [js开源组件开发]-手机端照片预览组件

    手机端照片预览组件 可怜的我用着华为3C手机,用别人现成的组件都好卡,为了适应我这种屌丝,于是自己简化写了一版的照片预览效果,暂时无缩放功能,以后可能有空再加吧,你也可以自己加下,这是个github上 ...

  4. js判断客户端是手机端还是PC端

    封装函数: function isPC() { var userAgentInfo = navigator.userAgent; var Agents = ["Android", ...

  5. 【转】自动识别是手机端还是pc端只用一行代码就搞定

    <script type="text/javascript"> var mobileAgent = new Array("iphone", &quo ...

  6. jquery做个日期选择适用于手机端

    第一步:做个 文本框用于显示年月日的 第二步:点击文本框触发bootstrap模态框并显示 第三步:我是建一个外部js页面写的 js中获得当前时间是年份和月份,形如:201208       //获取 ...

  7. js 检查是否为手机端

    let isMobile = function(){ let userAgentInfo = navigator.userAgent; let Agents = new Array("And ...

  8. js如何判断是手机端还是PC端访问

    function isMobile(){ var sUserAgent= navigator.userAgent.toLowerCase(), bIsIpad= sUserAgent.match(/i ...

  9. js.alert(重写)

    function dialogFn(Msg, btnOkCallBack, btnCancelCallBack) { $("body").append('<div id=&q ...

随机推荐

  1. ASP.NET Web API 学习【转】

    转自:http://www.cnblogs.com/babycool/p/3922738.html 来看看对于一般前台页面发起的get和post请求,我们在Web API中要如何来处理. 这里我使用J ...

  2. 【python】*与** 参数问题

    可变参数 在Python函数中,还可以定义可变参数.顾名思义,可变参数就是传入的参数个数是可变的,可以是1个.2个到任意个,还可以是0个. 我们以数学题为例子,给定一组数字a,b,c……,请计算a2 ...

  3. 墨菲定律-Murphy's Law (转载)

    墨菲定律 “墨菲定律”(Murphy's Law)亦称莫非定律.莫非定理.或摩菲定理,是西方世界常用的俚语. “墨菲定律”:事情往往会向你所想到的不好的方向发展,只要有这个可能性.比如你衣袋里有两把钥 ...

  4. error setting certificate verify locations: CAfile: E:/git/Git/mingw64/ssl/certs/ca-bundle.crt

    一.问题: 当git clone项目时报 error setting certificate verify locations: CAfile: E:/git/Git/mingw64/ssl/cert ...

  5. 树莓派 自身摄像头的opencv调用

    之前写过一篇随笔关于树莓派3上摄像头的调用,使用的方式是安装v4l2驱动. 实际上有一种更加简单的方法. 树莓派中的camera module是放在/boot/目录下以固件的形式加载的,不是一个标准的 ...

  6. django Q和F查询

    Q查询——对对象的复杂查询F查询——专门取对象中某列值的操作 Q查询1.Q对象(django.db.models.Q)可以对关键字参数进行封装,从而更好地应用多个查询,例如: from django. ...

  7. Python基础篇【第2篇】: Python内置函数(一)

    Python内置函数 lambda lambda表达式相当于函数体为单个return语句的普通函数的匿名函数.请注意,lambda语法并没有使用return关键字.开发者可以在任何可以使用函数引用的位 ...

  8. Python基础篇【第2篇】: Python文件操作

    Python文件操作 在Python中一个文件,就是一个操作对象,通过不同属性即可对文件进行各种操作.Python中提供了许多的内置函数和方法能够对文件进行基本操作. Python对文件的操作概括来说 ...

  9. AR

    http://jingyan.baidu.com/article/6766299727dcfc54d41b8455.html 1.注册.然后下载sdk(注册账号主要是为了第3步中制作识别图而用的) 下 ...

  10. MC3190终端配置冷启动自动恢复的方法

    一. 网络配置的恢复 将当前文件夹下的注册表文件MC3190 Start Config.reg(见附件)复制到终端的Application文件夹内(可以通过数据线或ftp方式传送文件); 导出终端的网 ...