遇到window.showModalDialog模态框的两个问题

1.导出Excel

<!-- 用于避免点击事件弹出另一个窗口 -->
<base id="base_tag" target="_self">

此时正常点击导出Excel事件时,没有任何反应,在百度上搜到答案,可以在模态框中加入iframe,将会弹出的新窗口指向这个iframe,并将此iframe设置为不可见

在<head>中将上面一句代码改为:

</pre><pre name="code" class="html"><span style="font-family: Arial, Helvetica, sans-serif;"><base target="baseExportThis"></span>
<pre name="code" class="html"><iframe id="baseExportThis" name="baseExportThis" height="0px" width="0px"></iframe>


导出Excel事件OK!


2.在此模态框中弹出“是否确认删除”对话框

当此模态框修改为上面的代码后,删除按钮又没有反应了(前台用的easyui),优化代码

以上导出Excel代码的两行代码更改为

</pre><pre name="code" class="html"><base id="base_tag" target="_self">
<iframe id="baseExportThis" name="baseExportThis" height="0px" width="0px"></iframe>
function exportHistoryExcel(){
	
	$("#base_tag").attr("target","baseExportThis");
	var form=$("<form>");//定义一个form表单
	form.attr("style","display:none");
	form.attr("method","post");
	form.attr("action","/test/testAction!exportExcel.action");
	$("body").append(form);//将表单放置在web中
	form.submit();
	$("#base_tag").attr("target","_self");
}

 删除事件OK! 


此时两个事件都OK!


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值