function systc() { var t = layer.confirm('确认要退出系统吗?', { btn: ['确定', '取消'] //按钮 }, function () { $("#btnDel").click(); }, function () { }); document.getElementById('layui-layer' + t).addEventListener("click", event); function event(e) { var that = e.target; switch (that.nodeName.toLowerCase()) { case 'a': //检测 类是否存在 ; if (that.innerText == "确定" || that.innerText == "取消" ) { var dm = document.getElementById('layui-layer' + t); dm.parentNode.removeChild(dm); var shade = document.getElementById('layui-layer-shade' + t); shade.parentNode.removeChild(shade); if (that.innerText == "确定") { $("#btnDel").click(); } } if (that.className.indexOf("layui-layer-close") != -1) { var dm = document.getElementById('layui-layer' + t); dm.parentNode.removeChild(dm); var shade = document.getElementById('layui-layer-shade' + t); shade.parentNode.removeChild(shade); } break; } e.cancelBubble = true; e.stopPropagation(); } }