<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
body{font-size:13px;}
.divshow{line-height:32px; height:32px; background-color:#eee; width:200px; padding-left:10px;}
.divshow span{padding-left:50px;}
.dialog{width:360px; border:5px solid #666; position:absolute; display:none; z-index:101}
.dialog .title{background-color:#fbaf15; padding:10px; color:#fff; font-weight:bold;}
.dialog .title img{float:right;}
.dialog .content{background-color:#fff; padding:25px; height:60px;}
.dialog .content img{float:left;}
.dialog .content span{float:left; padding:10px 0 0 10px;}
.dialog .bottom{text-align:right; padding:10px 10px 10px 0; background-color:#eee;}
.mask{width:100%; height:100%; background-color:#000; position:absolute; top:0px; left:0px; filter:alpha(opacity=30); display:none; z-index:100}
.btn{border:1px solid #666; padding:2px; width:65px; filter:progid:DXImageTransform.microsoft.Gradient(GradientType=0,StartColorStr=#ffffff;,EndColorStr=#ECE9D8);}
</style>
<script src="jquery-1.3.2.js"></script>
<script>
$(function(){
$("#Button1").click(function(){ //删除按钮的点击事件
$(".mask").show(); //显示背景色
showDialog(); //设置提示对话框的left与top值;
$(".dialog").show(); //显示提示对话框
});
function showDialog(){
var objW=$(window) //当前窗口
var brsW=objW.width();
var brsH=objW.height();
var scrL=objW.scrollLeft();
var scrH=objW.scrollTop();
var objC=$(".dialog") //对话框
var curW=objC.width();
var curH=objC.height();
//对话框居中时的左边距;
var left=scrL+(brsW-curW)/2;
//对话框居中时的上边距;
var top=scrH+(brsH-curH)/2;
//设置对话框在页面中的位置;
objC.css({"left":left,"top":top});
}
$(window).resize(function(){ //页面窗口大小改变事件
if(!$(".dialog").is(":visible")){
return
}
showDialog(); //设置对话框
})
$(".title img").click(function(){ //注册关闭图片点击事件
$(".dialog").hide();
$(".mask").hide();
})
$("#Button3").click(function(){ //注册取消按钮点击事件
$(".dialog").hide();
$(".mask").hide();
})
$("#Button2").click(function(){ //注册确定按钮点击事件
$(".dialog").hide();
$(".mask").hide();
if($("input:checked").length!=0){ //如果选择了删除行
$(".divshow").remove(); //删除数据
}
})
})
</script>
</head>
<body>
<div class="divshow">
<input id="Checkbox1" type="checkbox" />
<a href="#">这是一条可删除的记录</a>
<span><input id="Button1" type="button" value="删除" class="btn" /></span>
</div>
<div class="mask"></div>
<div class="dialog">
<div class="title"><img src="" alt="点击可关闭"/>删除时提示</div>
<div class="bottom"><input id="Button2" type="button" value="确定" class="btn" />
<input id="Button3" type="button" value="取消" class="btn" />
</div>
</div>
</body>
</html>