jquery刪除數(shù)據(jù)記錄時(shí)的彈出提示效果
更新時(shí)間:2014年05月06日 11:08:12 作者:
這篇文章主要介紹了jquery實(shí)現(xiàn)的刪除數(shù)據(jù)記錄時(shí)的彈出提示效果,需要的朋友可以參考下
提示效果如圖:(刪除提示框一直居中顯示)
<!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>
<title>刪除記錄時(shí)的提示效果</title>
<style type="text/css">
body{ font-size:13px;}
.divShow{ line-height:32px; height:32px; width:280px; background-color:#eee; padding-left:10px;}
.divShow span{ padding-left:50px;}
.dialog{ width:360px; border:solid 5px #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-top:10px; padding-left:10px;}
.dialog .bottom{ text-align:right; padding:10px 10px 10px 0px; background-color:#eee;}
.mask{ width:100%; height:100%; background-color:#000; position:absolute; top:0px; left:0px;
filter:alpha(opacity=30); z-index:100; display:none;}
.btn{ border:solid 1px #666; padding:2px; width:65px; filter:progid.DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff,
EndColorStr=#ECE9D8);}
</style>
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#Button1").click(function () { //注冊(cè)刪除按鈕點(diǎn)擊事件
$(".mask").show(); //顯示背景色
showDialog(); //設(shè)置提示對(duì)話框的Top與Left
$(".dialog").show(); //顯示提示對(duì)話框
});
/*根據(jù)當(dāng)前頁面與滾動(dòng)條位置,設(shè)置提示對(duì)話框的Top與Left*/
function showDialog() {
var objW = $(window); //當(dāng)前窗口
var objC = $(".dialog"); //對(duì)話框
var brsW = objW.width();
var brsH = objW.height();
var sclL = objW.scrollLeft();
var sclT = objW.scrollTop();
var cruW = objC.width();
var cruH = objC.height();
var left = sclL + (brsW - cruW) / 2; //計(jì)算對(duì)話框居中時(shí)的左邊距
var top = sclT + (brsH - cruH) / 2; //計(jì)算對(duì)話框居中時(shí)上邊距
objC.css({ "left": left, "top": top }); //設(shè)置對(duì)話框在頁面中的位置
}
$(window).resize(function () { //頁面窗口大小改變事件
if (!$(".dialog").is(":visible")) {
return;
}
showDialog(); //設(shè)置提示對(duì)話框的Top與Left
});
$(".title img").click(function () { //注冊(cè)關(guān)閉圖片點(diǎn)擊事件
$(".dialog").hide();
$(".mask").hide();
});
$("#Button3").click(function () { //注冊(cè)取消按鈕點(diǎn)擊事件
$(".dialog").hide();
$(".mask").hide();
});
$("#Button2").click(function () { //注冊(cè)確定按鈕點(diǎn)擊事件
$(".dialog").hide();
$(".mask").hide();
if ($("input:checked").length != 0) { //如果選擇了刪除行
$(".divShow").remove(); //刪除某行數(shù)據(jù)
}
});
});
</script>
</head>
<body>
<div class="divShow">
<input type="checkbox" id="Checkbox" />
<a href="#">這是一條可以刪除的記錄</a>
<span>
<input type="button" id="Button1" class="btn" value="刪除"/>
<input type="button" value="對(duì)比" />
</span>
</div>
<div class="mask"></div>
<div class="dialog">
<div class="title">
<img src="Images/close.gif" alt="點(diǎn)擊可以關(guān)閉" />刪除時(shí)提示
</div>
<div class="content">
<img src="Images/delete.jpg" alt="" />
<span>您真的要?jiǎng)h除該記錄嗎?</span>
</div>
<div class="bottom">
<input type="button" id="Button2" value="確定" class="btn" />
<input type="button" id="Button3" value="取消" class="btn" />
</div>
</div>
</body>
</html>
復(fù)制代碼 代碼如下:
<!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>
<title>刪除記錄時(shí)的提示效果</title>
<style type="text/css">
body{ font-size:13px;}
.divShow{ line-height:32px; height:32px; width:280px; background-color:#eee; padding-left:10px;}
.divShow span{ padding-left:50px;}
.dialog{ width:360px; border:solid 5px #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-top:10px; padding-left:10px;}
.dialog .bottom{ text-align:right; padding:10px 10px 10px 0px; background-color:#eee;}
.mask{ width:100%; height:100%; background-color:#000; position:absolute; top:0px; left:0px;
filter:alpha(opacity=30); z-index:100; display:none;}
.btn{ border:solid 1px #666; padding:2px; width:65px; filter:progid.DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff,
EndColorStr=#ECE9D8);}
</style>
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#Button1").click(function () { //注冊(cè)刪除按鈕點(diǎn)擊事件
$(".mask").show(); //顯示背景色
showDialog(); //設(shè)置提示對(duì)話框的Top與Left
$(".dialog").show(); //顯示提示對(duì)話框
});
/*根據(jù)當(dāng)前頁面與滾動(dòng)條位置,設(shè)置提示對(duì)話框的Top與Left*/
function showDialog() {
var objW = $(window); //當(dāng)前窗口
var objC = $(".dialog"); //對(duì)話框
var brsW = objW.width();
var brsH = objW.height();
var sclL = objW.scrollLeft();
var sclT = objW.scrollTop();
var cruW = objC.width();
var cruH = objC.height();
var left = sclL + (brsW - cruW) / 2; //計(jì)算對(duì)話框居中時(shí)的左邊距
var top = sclT + (brsH - cruH) / 2; //計(jì)算對(duì)話框居中時(shí)上邊距
objC.css({ "left": left, "top": top }); //設(shè)置對(duì)話框在頁面中的位置
}
$(window).resize(function () { //頁面窗口大小改變事件
if (!$(".dialog").is(":visible")) {
return;
}
showDialog(); //設(shè)置提示對(duì)話框的Top與Left
});
$(".title img").click(function () { //注冊(cè)關(guān)閉圖片點(diǎn)擊事件
$(".dialog").hide();
$(".mask").hide();
});
$("#Button3").click(function () { //注冊(cè)取消按鈕點(diǎn)擊事件
$(".dialog").hide();
$(".mask").hide();
});
$("#Button2").click(function () { //注冊(cè)確定按鈕點(diǎn)擊事件
$(".dialog").hide();
$(".mask").hide();
if ($("input:checked").length != 0) { //如果選擇了刪除行
$(".divShow").remove(); //刪除某行數(shù)據(jù)
}
});
});
</script>
</head>
<body>
<div class="divShow">
<input type="checkbox" id="Checkbox" />
<a href="#">這是一條可以刪除的記錄</a>
<span>
<input type="button" id="Button1" class="btn" value="刪除"/>
<input type="button" value="對(duì)比" />
</span>
</div>
<div class="mask"></div>
<div class="dialog">
<div class="title">
<img src="Images/close.gif" alt="點(diǎn)擊可以關(guān)閉" />刪除時(shí)提示
</div>
<div class="content">
<img src="Images/delete.jpg" alt="" />
<span>您真的要?jiǎng)h除該記錄嗎?</span>
</div>
<div class="bottom">
<input type="button" id="Button2" value="確定" class="btn" />
<input type="button" id="Button3" value="取消" class="btn" />
</div>
</div>
</body>
</html>
您可能感興趣的文章:
- jQuery實(shí)現(xiàn)鼠標(biāo)選中文字后彈出提示窗口效果【附demo源碼】
- jQuery實(shí)現(xiàn)頁面點(diǎn)擊后退彈出提示框的方法
- jQuery實(shí)現(xiàn)鼠標(biāo)經(jīng)過彈出提示信息的地圖熱點(diǎn)效果
- jQuery實(shí)現(xiàn)的卷簾門滑入滑出效果【案例】
- jQuery實(shí)現(xiàn)下拉菜單動(dòng)態(tài)添加數(shù)據(jù)點(diǎn)擊滑出收起其他功能
- jQuery實(shí)現(xiàn)的淡入淡出與滑入滑出效果示例
- jquery編寫彈出信息提示條并延時(shí)滑出動(dòng)畫實(shí)現(xiàn)示例
相關(guān)文章
Jquery和CSS實(shí)現(xiàn)選擇框重置按鈕功能
在本篇文章中我們給大家?guī)砹薐query和CSS實(shí)現(xiàn)選擇框重置按鈕功能的相關(guān)代碼,需要的朋友們參考下。2018-11-11
jQuery Easyui datagrid/treegrid 清空數(shù)據(jù)
這篇文章主要介紹了jQuery Easyui datagrid/treegrid 清空數(shù)據(jù)的相關(guān)資料2016-07-07
jQuery實(shí)現(xiàn)驗(yàn)證年齡簡(jiǎn)單思路
本文給大家分享的是jQuery實(shí)現(xiàn)驗(yàn)證年齡簡(jiǎn)單思路,讓用戶填出生年月,然后根據(jù)當(dāng)前時(shí)間計(jì)算是否小于網(wǎng)站要求的年齡,小于就提示,有需要的小伙伴可以拿去直接使用。2016-02-02

