<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>模拟的confirm</title>
<link href="css/global.css" rel="stylesheet"/>
<!-- confirm的重写 -->
<script type="text/javascript">
//网页被卷去的上高度
function EV_myScrollTop(){
var n=window.pageYOffset
|| document.documentElement.scrollTop
|| document.body.scrollTop || 0;
return n;
}
//网页被卷去的左宽度
function EV_myScrollLeft(){
var n=window.pageXOffset
|| document.documentElement.scrollLeft
|| document.body.scrollLeft || 0;
return n;
}
//网页可见区域宽
function EV_myClientWidth(){
var n=document.documentElement.clientWidth
|| document.body.clientWidth || 0;
return n;
}
//网页可见区域高
function EV_myClientHeight(){
var n=document.documentElement.clientHeight
|| document.body.clientHeight || 0;
return n;
}
function zg(){
var bgObj=document.getElementById("zg");
var bgWidth=EV_myClientWidth();
var bgHeight=EV_myClientHeight();
var bgTop=EV_myScrollTop();
var bgLeft=EV_myScrollLeft();
bgObj.style.position = "absolute";
bgObj.style.top = bgTop+"px";
bgObj.style.left = bgLeft+"px";
bgObj.style.width = bgWidth + "px";
bgObj.style.height = bgHeight + "px";
//bgObj.style.zIndex = "-10000";
bgObj.style.background = "#000";
bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=60,finishOpacity=60);";
bgObj.style.opacity = "0.5";
}
function show_cr(){
if (document.getElementById('show')==null){
var sh=document.createElement("div");
sh.setAttribute('class','wrap');
sh.innerHTML="<div id=\'show\' ><h3 class=\' show-title\'>提示:</h3><p class=\' show-con\'>确定要跳转</p><div class=\'tc\'><a id=\'sure\' class=\'show-btn\'>确定</a><a id=\'qx\' class=\' show-btn\'>取消</a></div></div>";
document.body.appendChild(sh);
}
}
function zg_cr() {
var bgObj=document.createElement("div");
bgObj.setAttribute('id','zg');
document.body.appendChild(bgObj);
}
function dj(url) {
show_cr();
zg_cr();
zg();
var so=document.getElementById("show");
var bgObj=document.getElementById("zg");
so.style.display="block";
var su =document.getElementById("sure");
su.onclick =function () {
window.location.href=url;
};
var qx =document.getElementById("qx");
qx.onclick =function () {
so.style.display="none";
document.body.removeChild(bgObj);
}
}
</script>
<style type="text/css">
/*confirm的样式*/
.tc{text-align:center;}
.wrap{position:fixed;top:35%;left:0;width:100%;z-index: 1000;}
#show{width:260px;height: 150px;margin: 0 auto;background:#fff;border-radius:10px;}
.show-title{border-radius:10px 10px 0 0;text-align:center;line-height:40px;background-color:#3586BC;color: #fff;font-weight: normal; }
.show-con{padding: 10px 0; text-align:center;text-overflow:ellipsis; overflow:hidden; white-space:nowrap; }
.show-btn{display: inline-block;padding: 5px 25px ;color: #fff;border-radius:5px;border: 2px solid #3586BC;background-color: #3586BC;text-decoration: none;transition: 0.4s;margin: 0 10px;}
.show-btn:hover{background-color: transparent;color: #3586BC;transition: 0.4s;}
</style>
</head>
<body>
<button onclick="dj('https://www.baidu.com')" >确定退出</button>
</body>
</html>

模拟的confirm的更多相关文章

  1. 如何模拟alert/confirm/prompt实现阻断程序运行

    场景:在执行js的时候,我们希望运行到某处,进行用户交互,根据交互的内容,运行下面的程序:下面的js程序需要用的和用户交互的内容,所以,和用户交互时,后面的程序必须停止运行 方案: 1. 原生的ale ...

  2. Selenium WebDriver- 操作JavaScript的confirm弹窗

    #encoding=utf-8 import unittest import time from selenium import webdriver from selenium.webdriver i ...

  3. 【webdriver自动化】整理API框架(主要是关键字,具体例子在本地)

    1. 获取网页源码 pageSource = self.driver.page_source print pageSource.encode("gbk","ignore& ...

  4. rabbitmq如何保证消息可靠性不丢失

    目录 生产者丢失消息 代码模拟 事务 confirm模式确实 数据退回监听 MQ事务相关软文推荐 MQ丢失信息 消费者丢失信息 之前我们简单介绍了rabbitmq的功能.他的作用就是方便我们的消息解耦 ...

  5. [转]jQuery插件实现模拟alert和confirm

    本文转自:http://www.jb51.net/article/54577.htm (function () { $.MsgBox = { Alert: function (title, msg) ...

  6. 模拟alert和confirm

    啥也不说,先上图,有图有真相 :) 现在绝大多数网站都不用自带的alert和confirm了,因为界面太生硬了.因此这个插件就这样产生了... 来看插件的实现代码吧: (function () { $ ...

  7. JS模拟Alert与Confirm对话框

    这2个例子都是用原生JS写的,主要是用JS拼接了界面,并未做过多的事件监听.,样式用了Css3的一些特性. 调用方式则为: //Alert Alert.show('我警告你哦~'); //Confir ...

  8. 模拟alert,confirm 阻塞状态

    /*** * 模拟alert弹窗 * content 为弹框显示的内容 * 确定按钮对应的下面取消关闭显示框 * **/function oAlert(content) { var oWrap = $ ...

  9. 自编jQuery插件实现模拟alert和confirm

    现在绝大多数网站都不用自带的alert和confirm了,因为界面太生硬了.因此这个插件就这样产生了自己定制一个的想法...... 啥也不说,先上图,有图有真相 :) 现在绝大多数网站都不用自带的al ...

随机推荐

  1. python的Web框架,Django模板变量,过滤器和静态文件引入

    HTML模板的路径查找 在setting中设置查找路径: #默认的查找在此处填写,优先级最高,为在manage.py的同级路径中,添加(常规是template)文件夹,在(template)文件夹中配 ...

  2. 1.1 PIL:Python图像处理类库

    from PIL import Image img = Image.open('Husky.jpg') # 看看这货长什么样子 img # 看看它的大小 print('The size of this ...

  3. WebApi实现单个文件的上传下载

    上传和下载是很常用的功能了,只有当用到的时候才发现不会写...,经过一番百度.筛选.整理修改后,实现了功能,下面简单的记录下实现方法. 一.上传功能 1.前端代码 上传文件 <input typ ...

  4. 在Android开发中替换资源图片不起作用的解决方法

    现象 在android开发中,经常会需要替换res\drawable中的图片,打开res\layout下的文件预览布局页面发现图片已经被替换,但在模拟器或者真实机器上运行时发现该图片并没有被替换,还是 ...

  5. c# 控制台应用程序批量修改文件夹下的后缀名(包括子文件夹)

    using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Tex ...

  6. [日常] Go语言圣经-并发的非阻塞缓存

    1.go test命令是一个按照约定和组织进行测试的程序2.竞争检查器 go run -race 附带一个运行期对共享变量访问工具的test,出现WARNING: DATA RACE 说明有数据竞争3 ...

  7. Java并发编程-移相器

    移相器(Phaser)内有2个重要状态,分别是phase和party.phase就是阶段,初值为0,当所有的线程执行完本轮任务,同时开始下一轮任务时,意味着当前阶段已结束,进入到下一阶段,phase的 ...

  8. Go 语言相关的优秀框架,库及软件列表

    If you see a package or project here that is no longer maintained or is not a good fit, please submi ...

  9. JS 关于this p9

    关于this这个货,常常让我感到头疼,也很难说清这货到底是什么机制,今天就详细记录一下this,了解他就跟理解闭包差不多,不理解的时候我们会感到很难受总想着避开他,当我们真正理解之后,会有种茅塞顿开的 ...

  10. Flutter Dart中的异步

    以下内容从官网得到: https://webdev.dartlang.org/articles/performance/event-loop Even-Looper Dart是单线程模型,也就没有了所 ...