// 删除成功提示
function alertMsg(text,sel,func){
if($('#dlg_del_x').length > 0){
$('#dlg_del_x').remove();
}
var model_div = document.createElement("div");
model_div.setAttribute("class","modal fade bs-example-modal-sm-alert");
model_div.setAttribute("id","dlg_del_x");
var modal_sm = document.createElement("div");
modal_sm.setAttribute("class","modal-dialog modal-sm");
var modal_content = document.createElement("div");
modal_content.setAttribute("class","modal-content");
var modal_header = document.createElement("div");
modal_header.setAttribute("class","modal-header");
var modal_but_x = document.createElement("button");
modal_but_x.setAttribute("class","close");
modal_but_x.setAttribute("data-dismiss","modal");
modal_but_x.setAttribute("aria-hidden","true");
modal_but_x.innerText = "×";
modal_header.appendChild(modal_but_x);
var modal_h4 = document.createElement("h4");
modal_h4.setAttribute("class","modal-title");
modal_h4.innerText = "提示";
modal_header.appendChild(modal_h4);
var modal_body = document.createElement("div");
modal_body.setAttribute("class","modal-body");
modal_body.setAttribute("id","dlg_del_x_msg");
modal_body.innerText = text;
var modal_footer = document.createElement("div");
modal_footer.setAttribute("class","modal-footer");
if( sel ){
var modal_but_cancel = document.createElement("button");
modal_but_cancel.setAttribute("type","button");
modal_but_cancel.setAttribute("class","btn btn-default");
modal_but_cancel.setAttribute("data-dismiss","modal");
modal_but_cancel.innerText = "取消";
modal_footer.appendChild(modal_but_cancel);
}
var modal_but_ok = document.createElement("button");
modal_but_ok.setAttribute("type","button");
modal_but_ok.setAttribute("class","btn btn-primary");
modal_but_ok.setAttribute("data-dismiss","modal");
modal_but_ok.innerText = "确定";
modal_footer.appendChild(modal_but_ok);
modal_but_ok.onclick = func;
modal_content.appendChild(modal_header);
modal_content.appendChild(modal_body);
modal_content.appendChild(modal_footer);
modal_sm.appendChild(modal_content);
model_div.appendChild(modal_sm);
document.body.appendChild(model_div);
$('#dlg_del_x').modal("show");
}
js 创建 新标签 注册事件,和回调函数封装
最新推荐文章于 2023-07-05 16:59:05 发布