纯js实现仿QQ邮箱弹出确认框


Posted in Javascript onApril 29, 2015

代码非常简单,这里就不多废话了。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML>
<HEAD>
<TITLE>QQ邮箱的弹出层</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
body {
background: none repeat scroll 0 0 #FFFFFF;
font-family: "lucida Grande",Verdana;
font-size: 12px;
}
select, body, textarea {
font-size: 12px;
}
.tipbg {
margin: 0;
padding: 0;
background-color: transparent;
}
.qmpanel_shadow {
border-radius: 3px 3px 3px 3px;
box-shadow: 0 2px 7px rgba(0, 0, 0, 0.35);
}
.bd_upload {
border: 1px solid #628D0B;
}
.bd_upload {
border: 1px solid #628D0B;
}
.fdbody {
border-left: 8px solid #FFFFFF;
border-right: 1px solid #87A34D;
}
.fdbody, .tipstitle {
background: none repeat scroll 0 0 #9BBB59;
}
.editor_dialog_title {
color: white;
font: bold 12px "lucida Grande",Verdana;
padding: 9px 0 7px 10px;
text-align: left;
}
.editor_dialog_content {
background: none repeat scroll 0 0 #FFFFFF;
filter: none;
margin: 0;
padding: 0;
text-align: center;
}
.mailinfo {
border-bottom: 2px solid #FFFFFF;
}
.mailinfo {
background: none repeat scroll 0 0 #FFFFFF;
}
.cnfx_content {
padding: 10px 0 5px 10px;
text-align: left;
}
.cnfx_status {
float: left;
padding: 0 0 0 10px;
}
.cnfx_btn {
padding: 0 10px 10px 0;
text-align: right;
}
.b_size {
font-size: 14px;
}
.editor_close {
background: none repeat scroll 0 0 #DC4835;
}
/** when mouseover,add editor_close_mover*/
.editor_close, .editor_close_mover {
border: 1px solid #A7190F;
cursor: pointer;
float: right;
margin: 7px 7px 0 0;
}
.editor_close img, .editor_close_mover img, .editor_min img, .editor_min_mover img {
display: block;
}
img {
border: medium none;
}
.wd2 {
margin: 1px 1px 0 0;
width: 64px;
}
.btn, button, .qm_btn {
padding-left: 0;
padding-right: 0;
}
input, textarea, a {
outline: medium none;
}
.editor_mask {
background: none repeat scroll 0 0 #FFFFFF;
height: 100%;
left: 0;
opacity: 0.5;
position: absolute;
top: 0;
width: 100%;
}
</style>
<script>
///////// 拖拽工具类 ////////
var DragUtil = (function(){
var doc = document;

var moveX = 0;
var moveY = 0;
var moveTop = 0;
var moveLeft = 0;
var moveable = false;
return {
/**
* 注册拖拽
* 需要传入整个窗体id和标题部分的id
*/
regist:function(winId,titleId) {
// 页面头部要加上:
// <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
// 不然会有问题的
var width = doc.documentElement.clientWidth; 
var height = doc.documentElement.clientHeight; 
var title = doc.getElementById(titleId);
var win = doc.getElementById(winId);
title.onmousedown = function() {
var evt = DragUtil._getEvent();

moveable = true; 
moveX = evt.clientX;
moveY = evt.clientY;

moveTop = parseInt(win.style.top);
moveLeft = parseInt(win.style.left);

doc.onmousemove = function() {
if (moveable) {
var evt = DragUtil._getEvent();
var x = moveLeft + evt.clientX - moveX;

var y = moveTop + evt.clientY - moveY;
var w = parseInt(win.style.width);
var h = parseInt(win.style.height);


if ( x > 0 &&( x + w < width) && y > 0 && (y + h < height) ) {
win.style.left = x + "px";
win.style.top = y + "px";
}
} 
};
doc.onmouseup = function () { 
if (moveable) { 
//doc.onmousemove = docMouseMoveEvent;
//doc.onmouseup = docMouseUpEvent;
moveable = false; 
moveX = 0;
moveY = 0;
moveTop = 0;
moveLeft = 0;
} 
};
}
}
/**
* 获取事件
*/
,_getEvent:function(){
return window.event || arguments.callee.caller.arguments[0];
}
}
})()
///////////////////////
function init(){
DragUtil.regist("WindowId","titleId")
DragUtil.regist("WindowId2","titleId2")
} 
</script>
</HEAD>
<BODY onload="init()">
<span id="qmdialog_container"><div
style="z-index: 1120; position: absolute; width: 447px; height: 163px; opacity: 1; left: 514px; top: 124px; margin-top: 0pt;"
class="" id="WindowId" qmanimation_play="|undefined">
<div class="tipbg">
<div style="background: #DDD;" class="opashowOuter qmpanel_shadow"
id="QMconfirm___opashow_">
<table cellspacing="0" cellpadding="0"
style="width: 447px; height: 163px;background: white;"
class="bd_upload">
<tbody>
<tr>
<td
style="height: 28px; border: none; background-image: none; cursor: move; overflow: hidden;"
class="editor_dialog_titlebar fdbody"
id="QMconfirm___title_td_"><div
id="QMconfirm___title_div_"
style="cursor: default; float: right; width: 40px; border: none; background-image: none;"
class="fdbody">
<div onmouseout="this.className='editor_close';"
onmouseover="this.className='editor_close_mover';"
class="editor_close" id="QMconfirm___closebtn2_">
<img height="12" width="12" ondragstart="return false;" src="https://3water.com/jscss/demoimg/201109/ico_closetip.gif">
</div>
</div>
<div id="titleId" class="editor_dialog_title">删除确认</div>
</td>
</tr>
<tr>
<td valign="top"
style="height: 131px; border: medium none; visibility: visible;"
class="editor_dialog_content " id="QMconfirm___content_"><div
class="mailinfo"
style="border: none; height: 100%; display: inline;">
<div class="">
<div class="cnfx_content">
<img align="absmiddle"
style="float: left; margin: 5px 10px 0; display: block;"
src="https://3water.com/jscss/demoimg/201109/ico_question.gif">
<table style="width: 350px; height: 80px;">
<tbody>
<tr>
<td style="vertical-align: top;"><div class="b_size"
style="padding-top: 10px; word-break: break-all; line-height: 150%;">
<div>彻底删除后邮件将无法恢复,您确定要删除吗?</div>
</div></td></tr></tbody>
</table>
</div>
<div style="display: none;" class="cnfx_status">
<input type="checkbox" id="QMconfirm__recordstatus"><label for="QMconfirm__recordstatus"></label>
</div>
<div class="cnfx_btn">
<input type="button" value="确定" id="QMconfirm__confirm" class="wd2 btn"><input type="button" value="取消" style="display: ;" id="QMconfirm__cancel" class="wd2 btn"><input type="button" value="" style="display: none;" id="QMconfirm__never" class="wd2 btn">
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</span>
<span id="qmdialog_container"><div
style="z-index: 1120; position: absolute; width: 447px; height: 163px; opacity: 1; left: 514px; top: 324px; margin-top: 0pt;"
class="" id="WindowId2" qmanimation_play="|undefined">
<div class="tipbg">
<div style="background: #DDD;" class="opashowOuter qmpanel_shadow" id="QMconfirm___opashow_">
<table cellspacing="0" cellpadding="0" style="width: 447px; height: 163px;background: white;" class="bd_upload">
<tbody>
<tr>
<td style="height: 28px; border: none; background-image: none; cursor: move; overflow: hidden;" class="editor_dialog_titlebar fdbody" id="QMconfirm___title_td_"><div id="QMconfirm___title_div_" style="cursor: default; float: right; width: 40px; border: none; background-image:none;" class="fdbody">
<div onmouseout="this.className='editor_close';" onmouseover="this.className='editor_close_mover';" class="editor_close" id="QMconfirm___closebtn2_">
<img height="12" width="12" ondragstart="return false;" src="https://3water.com/jscss/demoimg/201109/ico_closetip.gif">
</div>
</div>
<div id="titleId2" class="editor_dialog_title">删除确认</div>
</td>
</tr>
<tr>
<td valign="top" style="height: 131px; border: medium none; visibility: visible;" class="editor_dialog_content " id="QMconfirm___content_"><div class="mailinfo" style="border: none; height: 100%; display: inline;">
<div class="">
<div class="cnfx_content">
<img align="absmiddle"
style="float: left; margin: 5px 10px 0; display:none;" src="https://3water.com/jscss/demoimg/201109/ico_question.gif">
<table style="width: 350px; height: 80px;">
<tbody>
<tr>
<td style="vertical-align: top;"><div class="b_size" style="padding-top: 10px; word-break: break-all; line-height: 150%;">
<div>彻底删除


后邮件将无法恢复,您确定要删除吗?</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div style="display: none;" class="cnfx_status">
<input type="checkbox" id="QMconfirm__recordstatus"><label for="QMconfirm__recordstatus"></label>
</div>
<div class="cnfx_btn">
<input type="button" value="确定" id="QMconfirm__confirm" class="wd2 btn"><input type="button" value="取消" style="display: ;" id="QMconfirm__cancel" class="wd2btn"><input
type="button" value="" style="display: none;"
id="QMconfirm__never" class="wd2 btn">
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</span> 
</BODY>
</HTML>

以上所述就是本文的全部内容了,希望大家能够喜欢。

Javascript 相关文章推荐
[对联广告] JS脚本类
Aug 27 Javascript
执行iframe中的javascript方法
Oct 07 Javascript
Jquery 设置标题的自动翻转
Oct 03 Javascript
jQuery toggle()设置CSS样式
Nov 05 Javascript
原生js实现查询天气小应用
Dec 09 Javascript
使用vue.js实现联动效果的示例代码
Jan 10 Javascript
利用Mongoose让JSON数据直接插入或更新到MongoDB
May 03 Javascript
JavaScript动态绑定详解
Sep 14 Javascript
javascript实现切割轮播效果
Nov 28 Javascript
js实现点击生成随机div
Jan 16 Javascript
JavaScript canvas绘制渐变颜色的矩形
Feb 18 Javascript
js模拟实现百度搜索
Jun 28 Javascript
jQuery()方法的第二个参数详解
Apr 29 #Javascript
AngularJS模块管理问题的非常规处理方法
Apr 29 #Javascript
javascript通过元素id和name直接取得元素的方法
Apr 28 #Javascript
javascript中in运算符用法分析
Apr 28 #Javascript
setTimeout内不支持jquery的选择器的解决方案
Apr 28 #Javascript
chrome不支持form.submit的解决方案
Apr 28 #Javascript
javascript截取字符串小结
Apr 28 #Javascript
You might like
php 字符转义 注意事项
2009/05/27 PHP
关于file_get_contents返回为空或函数不可用的解决方案
2013/06/24 PHP
PHP会话控制:Session与Cookie详解
2014/09/27 PHP
php使用sql server验证连接数据库的方法
2014/12/25 PHP
thinkphp 抓取网站的内容并且保存到本地的实例详解
2017/08/25 PHP
使用PHP访问RabbitMQ消息队列的方法示例
2018/06/06 PHP
laravel执行php artisan migrate报错的解决方法
2019/10/09 PHP
PHP PDO和消息队列的个人理解与应用实例分析
2019/11/25 PHP
用Javascript实现Windows任务管理器的代码
2012/03/27 Javascript
js渐变显示渐变消失示例代码
2013/08/01 Javascript
Jquery获取和修改img的src值的方法
2014/02/17 Javascript
一个简单的jQuery计算器实现了连续计算功能
2014/07/21 Javascript
浅谈JS中String()与 .toString()的区别
2016/10/20 Javascript
浅谈EasyUi ComBotree树修改 父节点选择的问题
2016/11/07 Javascript
node安装--linux下的快速安装教程
2017/03/21 Javascript
微信小程序表单验证WxValidate的使用
2019/11/27 Javascript
vue项目中监听手机物理返回键的实现
2020/01/18 Javascript
Python设计实现的计算器功能完整实例
2017/08/18 Python
Python3和pyqt5实现控件数据动态显示方式
2019/12/13 Python
python re模块匹配贪婪和非贪婪模式详解
2020/02/11 Python
使用keras实现densenet和Xception的模型融合
2020/05/23 Python
python中if及if-else如何使用
2020/06/02 Python
CentOS 7如何实现定时执行python脚本
2020/06/24 Python
ASP.NET Core中的配置详解
2021/02/05 Python
python 高阶函数简单介绍
2021/02/19 Python
美国家居装饰店:Pier 1
2019/09/04 全球购物
加拿大大码女装购物网站:Penningtons
2020/12/26 全球购物
自行车租赁公司创业计划书
2014/01/28 职场文书
信访工作经验交流材料
2014/05/23 职场文书
感恩教育月活动总结
2014/07/07 职场文书
食品安全汇报材料
2014/08/18 职场文书
担保书范文
2015/01/20 职场文书
解决numpy和torch数据类型转化的问题
2021/05/23 Python
MySQL一劳永逸永久支持输入中文的方法实例
2022/08/05 MySQL
spring boot实现文件上传
2022/08/14 Java/Android
Python使用pandas导入xlsx格式的excel文件内容操作代码
2022/12/24 Python