模拟的confirm
<!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的更多相关文章
- 如何模拟alert/confirm/prompt实现阻断程序运行
场景:在执行js的时候,我们希望运行到某处,进行用户交互,根据交互的内容,运行下面的程序:下面的js程序需要用的和用户交互的内容,所以,和用户交互时,后面的程序必须停止运行 方案: 1. 原生的ale ...
- Selenium WebDriver- 操作JavaScript的confirm弹窗
#encoding=utf-8 import unittest import time from selenium import webdriver from selenium.webdriver i ...
- 【webdriver自动化】整理API框架(主要是关键字,具体例子在本地)
1. 获取网页源码 pageSource = self.driver.page_source print pageSource.encode("gbk","ignore& ...
- rabbitmq如何保证消息可靠性不丢失
目录 生产者丢失消息 代码模拟 事务 confirm模式确实 数据退回监听 MQ事务相关软文推荐 MQ丢失信息 消费者丢失信息 之前我们简单介绍了rabbitmq的功能.他的作用就是方便我们的消息解耦 ...
- [转]jQuery插件实现模拟alert和confirm
本文转自:http://www.jb51.net/article/54577.htm (function () { $.MsgBox = { Alert: function (title, msg) ...
- 模拟alert和confirm
啥也不说,先上图,有图有真相 :) 现在绝大多数网站都不用自带的alert和confirm了,因为界面太生硬了.因此这个插件就这样产生了... 来看插件的实现代码吧: (function () { $ ...
- JS模拟Alert与Confirm对话框
这2个例子都是用原生JS写的,主要是用JS拼接了界面,并未做过多的事件监听.,样式用了Css3的一些特性. 调用方式则为: //Alert Alert.show('我警告你哦~'); //Confir ...
- 模拟alert,confirm 阻塞状态
/*** * 模拟alert弹窗 * content 为弹框显示的内容 * 确定按钮对应的下面取消关闭显示框 * **/function oAlert(content) { var oWrap = $ ...
- 自编jQuery插件实现模拟alert和confirm
现在绝大多数网站都不用自带的alert和confirm了,因为界面太生硬了.因此这个插件就这样产生了自己定制一个的想法...... 啥也不说,先上图,有图有真相 :) 现在绝大多数网站都不用自带的al ...
随机推荐
- Redhat6.8下安装Oracle11gR2
Step1.配置本地yum源,方便安装依赖包 df -h 补充: df命令查看 linux系统磁盘空间以及使用情况,-h代表方便阅读方式显示 :/dev/sr0为光驱设备名 mkdir cdrom ...
- [开源] .NET数据库ORM类库 Insql
介绍 新年之际,给大家介绍个我自己开发的ORM类库Insql.TA是一个轻量级的.NET ORM类库 . 对象映射基于Dapper , Sql配置灵感来自于Mybatis.简单优雅性能是TA的追求. ...
- ffplay源码分析3-代码框架
ffplay是FFmpeg工程自带的简单播放器,使用FFmpeg提供的解码器和SDL库进行视频播放.本文基于FFmpeg工程4.1版本进行分析,其中ffplay源码清单如下: https://gith ...
- Netty 源码剖析之 unSafe.write 方法
前言 在 Netty 源码剖析之 unSafe.read 方法 一文中,我们研究了 read 方法的实现,这是读取内容到容器,再看看 Netty 是如何将内容从容器输出 Channel 的吧. 1. ...
- ASP.NET C# List分页
List.Skip((pagecount-1)*pagesize).Take(pagesize) 假设你每页10条数据当前是第3页 跳到第4页则:List.Skip((4-1)*10).Take(10 ...
- [日常] Linux下vim的常用命令总结
vim按d表示剪切按dd剪切一行vim命令:命令模式 /关键字 n继续向下查找 vim的多行注释:1.按ctrl + v进入 visual block模式2.按上下选中要注释的行3.按大写字母I,再插 ...
- Java基础——collection接口
一.Collection接口的定义 public interfaceCollection<E>extends iterable<E> 从接口的定义中可以发现,此接口使用了泛型 ...
- 畅通工程(hdu1232)并查集
畅通工程 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submi ...
- PageHelper的使用方法
Mybatis分页组件Mybatis-PageHelper使用流程 只需要两步即可: 1.添加依赖 <!--PageHelper--> <dependency> <gro ...
- Android四大组件framework层
activity https://www.kancloud.cn/alex_wsc/android-deep2/413484 当前Activity Activity向AMS发送StartActivit ...