HTML
<div class="dialog" id="delallpartdialog">
<div class="title">
<img alt="点击可以关闭" src="/static/images/disk.png" width="30px" height="30px;">
确认提示
</div>
<div class="content">
<span>你真的要删除所有分区吗?</span>
</div>
<div class="bottom">
<input type="button" value="确定" class="btnok">
<input type="button" value="取消" class="btnnoOk">
</div>
</div>
CSS
.dialog{360px;border:1px #666 solid;position:absolute;display:none;z-index:101;}
.dialog .title {background: #333;padding:10px; color: #fff; font-weight: bold; }
.dialog .content {background: #fff;padding:25px;height: 60px;}
.dialog .content img {float: left;}
.dialog .content span {float: left;padding:10px;}
.dialog .bottom {text-align: right;padding:10px 10px 10px 0px;background: #eee;}
.dialog .btn {border: #666 1px solid;65px;}
JQuery
$(".delallpart").on("click",function () {
$.ajax({
url:"/osd/opt/delallpart",
type: "POST",
datatype:'json',
data: {"action":"del_all","del_mount":"2"},
beforeSend: function (xhr, settings) {
xhr.setRequestHeader("X-CSRFToken", getCookie2('csrftoken'));
},
success: function (arg) {
var div = $("#delallpartdialog");
div.css("display", "block");
div.css("left", 500).css("top", 500);
}
});
});
$(".dialog").on("click",".btnnoOk", function () {
alert("not ok");
$(this).parents(".dialog").css("display", "none");
});
$("#delallpartdialog").on("click",".btnok", function () {
alert("ok!");
});