<!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. nginx tar.gz安装方法+简单静态文件配置

    1.首先安装依赖包(依赖包有点多,我们采用yum的方式来安装) yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel ...

  2. Bootstrap 3 管理模板

    下面这 10 个模板是从最新的 Bootstrap 3 管理模板人工挑选出来的,用来构建网站的后台管理界面,这些模板都是在最近 2 个月内发布. 1. Curo – Admin Template Cu ...

  3. 6、java中的构造代码块

    /* 演示构造代码块的应用 */ class Person { String name; int age; //构造代码块 { cry(); } Person(String name, int age ...

  4. Mina 资料

    http://blog.csdn.net/cutesource/article/category/631854 http://wslfh2005.iteye.com/ http://www.cnblo ...

  5. bzoj3822: 文学

    Description 巨酱和主席是一对好朋友.他们都很喜欢读书,经常一起阅读相关领域书籍,进行系统的学习.一天主席列出了一份列表,里面共 p 本书,其中不乏<约翰克里斯多夫>,<名 ...

  6. 黄聪:MYSQL使服务器内存CPU占用过高问题的分析及解决方法

    方法一: 使用 show processlist 语句,查找负荷最重的 SQL 语句,优化该SQL,比如适当建立某字段的索引. 方法二: #查看慢SQL日志是否启用mysql> show var ...

  7. PLSQL 逻辑多线程机制

    CREATE OR REPLACE PACKAGE jv_para_pkg IS PROCEDURE main(i_job_name   VARCHAR2,                 i_job ...

  8. c# 串口编程

    http://news.ccidnet.com/art/32859/20100524/2067861_4.html 字节缓冲器处理类: /// <summary> /// 字节缓冲器 // ...

  9. AX2012 审批流流转到已停用的域账号导致审批流停止

    AX 2012 中当审批流流转到某个节点时,如果在该节点的审批人的域账号被停用,审批流将会停止,会报如图的错误: 要解决这个问题,得修改标准功能,需要修改SysWorkflow和SysWorkflow ...

  10. 使用PHP导入和导出CSV文件

    我们先准备mysql数据表,假设项目中有一张记录学生信息的表student,并有id,name,sex,age分别记录学生的姓名.性别.年龄等信息. CREATE TABLE `student` ( ...