在引用JS、CSS的条件下
<buttontype="button"class="layui-btn"onclick="xadmin.open('班期添加','./banqi_add.aspx',600,600)">添加</button>
把稳:必须包含type="button",否则弹出的窗口会“一闪而过”。
$(function() {//关闭弹窗 $(document).on('click','#closeBtn', function() { //先得到当前iframe层的索引 varindex=parent.layer.getFrameIndex(window.name); parent.location.reload();//刷新父页面,把稳一定要在关闭当前iframe层之前实行刷新 parent.layer.close(index);//再实行关闭 });});
2、在asp.net中运用
在弹出的窗口添加数据,成功后弹出提示,点击关闭后,自动关闭弹窗,并刷新父窗口。

protectedvoidButton1_Click(objectsender,EventArgse) { if(!DoAdd()) { Response.Write("<script>alert('缺点!
');</script>"); return; } else { Response.Write("<script>alert('揭橥成功!
');var index = parent.layer.getFrameIndex(window.name);parent.location.reload();parent.layer.close(index); </script>"); } }