js重写alert()弹窗
//重写alert
window.alert = function(str)
{
var alertFram = document.getElementById('alertFram');
var shield = document.createElement("DIV");
shield.id = "shield";
shield.style.position = "absolute";
shield.style.left = "50%";
shield.style.top = "50%";
shield.style.width = "300px";
shield.style.height = "300px";
shield.style.marginLeft = "-150px";
shield.style.marginTop = "-150px";
shield.style.zIndex = "25";
if( !alertFram ) { //防止重复弹出两个弹窗,且不能关闭
alertFram = document.createElement("DIV");
alertFram.id = "alertFram";
alertFram.style.position = "fixed";
alertFram.style.width = "300px";
alertFram.style.height = "200px";
alertFram.style.left = "50%";
alertFram.style.top = "0";
alertFram.style.marginLeft = "-150px";
alertFram.style.marginTop = "30px";
alertFram.style.textAlign = "center";
alertFram.style.lineHeight = "150px";
alertFram.style.zIndex = "1100";
document.body.appendChild(alertFram);
document.body.appendChild(shield);
}else{
alertFram.style.display = "";
shield.style.display = "";
}
strHtml = '<div class="alert_ul" style="list-style:none;margin:0px;padding:0px;width:100%;">';
strHtml += '<p class="alert_title" style="background: #fff;letter-spacing: 2px;text-align: left;padding-left: 20px;line-height: 50px;font-size: 20px;border-top: 1px solid #91AFA5;border-left: 1px solid #91AFA5;border-right: 1px solid #91AFA5;border-top-left-radius: 3px;border-top-right-radius: 3px;">消息提示</p>';
strHtml += '<p class="alert_content" style="background: #fff;text-align: left;height: auto;color: #999;line-height: 25px;font-size: 14px;letter-spacing: 2px;padding: 0 20px 25px;border-left: 1px solid #91AFA5;border-right: 1px solid #91AFA5;">'+str+'</p>';
strHtml += '<p class="alert_btn_wrap" style="background: #fff;line-height: 25px;padding: 0 18px 18px;border-left: 1px solid #91AFA5;border-right: 1px solid #91AFA5;border-bottom: 1px solid #91AFA5;border-bottom-left-radius: 3px;border-bottom-right-radius: 3px;"><input type="button" value="确 定" onclick="doOk()" class="alert_btn" style="border: none;outline: none; -moz-appearance: none; -webkit-appearance: none;appearance:none;width:80px;height:40px;background:#44E7BA;border-radius: 3px;;cursor:pointer;color:#fff; -webkit-transition: background 0.2s;transition: background 0.2s;font-size: 16px;"/></p>';
strHtml += '</div>';
alertFram.innerHTML = strHtml; this.doOk = function(){
alertFram.style.display = "none";
shield.style.display = "none";
}
alertFram.focus();
document.body.onselectstart = function(){return false;};
}
js重写alert()弹窗的更多相关文章
- JS重写alert,保证弹窗错误的友好性
// ------------------------------------------------------------- // 重写alert,保证弹窗错误的友好性 var j_oldAler ...
- 原生 js 模拟 alert 弹窗
复制头部的 js 代码到你的 js 文件的任何地方,调用Chef.alert方法传入相应的参数即可并没有什么功能,只是一个提示的作用,可能样式比 alert 的弹窗好看点,css是写在js里的,只要你 ...
- CEF拦截js层alert弹窗 OnJSDialog 《转》
一 引言 CEF3嵌入后,用JS 弹出Alert框,按钮错位,确定按钮勉强能看到.很难看.为了改善体验,决定重写提示框. 环境:VS2008 VC MFC. 二 原理 参看类 CefJSDia ...
- JS 重写alert,使之能输出多个参数
windows._alert = windows.alert; windows.alert = function(){ _alert = (Array.prototype.slice(argument ...
- js 重写alert 兼容iphone使得alert 不带src
<script> window.alert = function(name){ var iframe = document.createElement("IFRAME" ...
- [Winform]Cefsharp重写alert与confirm弹窗
摘要 在使用winform内嵌cefsharp浏览本地页面的时候,如果出现alert弹窗,会在标题栏显示页面所在目录.所以想起来重写alert的样式,通过winform的MessageBox进行提示. ...
- Cef 重写alert与confirm弹窗
在使用form内嵌cef浏览本地页面的时候,如果出现alert弹窗,会在标题栏显示页面所在目录.所以想起来重写alert的样式,通过MessageBox进行提示,或者自己写一个弹窗. 以下代码基于 3 ...
- 修改js confirm alert 提示框文字的简单实例
修改js confirm alert 提示框文字的简单实例: <!DOCTYPE html> <html> <head lang="en"> & ...
- 移动端开发(使用webuploader上传图片,客户端交互,修改alert弹窗等)
之前实习做的一个移动端的页面 需要的功能有图片上传 点击客户端的返回按钮 有提示(即与客户端有交互) 遇到不少的坑 总结一下问题 1.图片上传功能 使用工具 百度的webuploader 暂时遇到的 ...
随机推荐
- 洛谷—— P1690 贪婪的Copy
https://www.luogu.org/problem/show?pid=1690 题目描述 Copy从卢牛那里听说在一片叫yz的神的领域埋藏着不少宝藏,于是Copy来到了这个被划分为个区域的神地 ...
- cogs——1215. [Tyvj Aug11] 冗余电网
1215. [Tyvj Aug11] 冗余电网 ★ 输入文件:ugrid.in 输出文件:ugrid.out 简单对比 时间限制:1 s 内存限制:128 MB TYVJ八月月赛提高组 ...
- 【.Net 学习系列】-- .Net 指定时间段内定时执行的Windows服务(System.Threading.Thread)
创建一个Windows服务项目:解决方案(右击)——> 添加 ——> 新建项目——>项目类型选择Windows——>模板选择Windows服务 ,如图: 编写Windows服务 ...
- 【CV论文阅读】+【搬运工】LocNet: Improving Localization Accuracy for Object Detection + A Theoretical analysis of feature pooling in Visual Recognition
论文的关注点在于如何提高bounding box的定位,使用的是概率的预测形式,模型的基础是region proposal.论文提出一个locNet的深度网络,不在依赖于回归方程.论文中提到locne ...
- 离线安装Cloudera Manager5.3.4与CDH5.3.4
文章转载:http://www.aboutyun.com/thread-14024-1-1.html 前期准备工作(系统环境搭建) 操作系统:CentOS 6.5 x64 CPU*2 64G 300G ...
- 介绍css 的3D 变换(3D transform)
https://desandro.github.io/3dtransforms/docs/card-flip.html ---------------------------------------- ...
- Apple Swift编程语言新手教程
文件夹 1 简单介绍 2 Swift入门 3 简单值 4 控制流 5 函数与闭包 6 对象与类 7 枚举与结构 1 简单介绍 今天凌晨Apple刚刚公布了Swift编程 ...
- Growth: 一个关于怎样成为优秀Web Developer 的 App
想了想还是决定在今天公布一个预览版.这样才干持续改进.Growth是一个关于怎样成为优秀的Web Developer的APP--结合技能树.成长路线图.进阶书单.Web七日谈以及一些小測验. 它是我对 ...
- C#获取当前活动窗口句柄
c# 获取当前活动窗口句柄,获取窗口大小及位置 2018年04月26日 13:48:21 漂泊_人生 阅读数:1889 需调用API函数 需在开头引入命名空间using System.Runtim ...
- Python中flatten用法
Python中flatten用法 原创 2014年04月16日 10:20:02 标签: Python / flatten 22667 一.用在数组 >>> a = [[1,3],[ ...