国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

js簡單實現刪除記錄時的提示效果

2019-11-20 21:30:50
字體:
來源:轉載
供稿:網友
樣式
復制代碼 代碼如下:

<style type="text/css">
body{font-size:13px}
.divShow{line-height:32px;height:32px;background-color:#eee;width:280px;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);display:none;z-index:100}
.btn {border:#666 1px solid;padding:2px;width:65px;
filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff, EndColorStr=#ECE9D8);}

</style>

jquery
復制代碼 代碼如下:

<script type="text/javascript">
$(function() {
$("#Button1").click(function() { //注冊刪除按鈕點擊事件
$(".mask").show(); //顯示背景色
showDialog(); //設置提示對話框的Top與Left
$(".dialog").show(); //顯示提示對話框
})
/*
*根據當前頁面與滾動條位置,設置提示對話框的Top與Left
*/
function showDialog() {
var objW = $(window); //當前窗口
var objC = $(".dialog"); //對話框
var brsW = objW.width();
var brsH = objW.height();
var sclL = objW.scrollLeft();
var sclT = objW.scrollTop();
var curW = objC.width();
var curH = objC.height();
//計算對話框居中時的左邊距
var left = sclL + (brsW - curW) / 2;
//計算對話框居中時的上邊距
var top = sclT + (brsH - curH) / 2;
//設置對話框在頁面中的位置
objC.css({ "left": left, "top": top });
}


$(window).resize(function() {//頁面窗口大小改變事件
if (!$(".dialog").is(":visible")) {
return;
}
showDialog(); //設置提示對話框的Top與Left
});


$(".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>

html
復制代碼 代碼如下:

<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="Images/close.gif" alt="點擊可以關閉" />刪除時提示
</div>
<div class="content">
<img src="Images/delete.jpg" alt="" /><span>您真的要刪除該條記錄嗎?</span>
</div>
<div class="bottom">
<input id="Button2" type="button" value="確定" class="btn"/>  
<input id="Button3" type="button" value="取消" class="btn"/>
</div>
</div>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 珲春市| 县级市| 临夏县| 浦北县| 正阳县| 永平县| 甘德县| 新泰市| 宜春市| 四川省| 万荣县| 郯城县| 五寨县| 越西县| 罗定市| 舞钢市| 罗江县| 古交市| 即墨市| 巴彦淖尔市| 邹平县| 文安县| 贵德县| 海南省| 本溪市| 高安市| 安化县| 浏阳市| 咸阳市| 陇西县| 金塔县| 开远市| 监利县| 响水县| 奈曼旗| 屯门区| 石景山区| 酒泉市| 新晃| 佳木斯市| 望城县|