如何使用bootstrap实现删除确认框
2016-11-18 · 知道合伙人软件行家
关注
展开全部
一、定义dialog会话框
<!-- 信息删除确认 -->
<div class="modal fade" id="delcfmModel">
<div class="modal-dialog">
<div class="modal-content message_align">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">提示信息</h4>
</div>
<div class="modal-body">
<p>您确认要删除吗?</p>
</div>
<div class="modal-footer">
<input type="hidden" id="url"/>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<a onclick="urlSubmit()" class="btn btn-success" data-dismiss="modal">确定</a>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
二、删除button
<a class="btn btn-primary" onClick="delcfm('${ctxPath}/manager/project/delete?id=${vo.id?default("")}')">删除</a>
三、js定义
function delcfm(url) {
$('#url').val(url);//给会话中的隐藏属性URL赋值
$('#delcfmModel').modal();
}
function urlSubmit(){
var url=$.trim($("#url").val());//获取会话中的隐藏属性URL
window.location.href=url;
}
<!-- 信息删除确认 -->
<div class="modal fade" id="delcfmModel">
<div class="modal-dialog">
<div class="modal-content message_align">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">提示信息</h4>
</div>
<div class="modal-body">
<p>您确认要删除吗?</p>
</div>
<div class="modal-footer">
<input type="hidden" id="url"/>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<a onclick="urlSubmit()" class="btn btn-success" data-dismiss="modal">确定</a>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
二、删除button
<a class="btn btn-primary" onClick="delcfm('${ctxPath}/manager/project/delete?id=${vo.id?default("")}')">删除</a>
三、js定义
function delcfm(url) {
$('#url').val(url);//给会话中的隐藏属性URL赋值
$('#delcfmModel').modal();
}
function urlSubmit(){
var url=$.trim($("#url").val());//获取会话中的隐藏属性URL
window.location.href=url;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询