firefox浏览器与IE浏览器不兼容问题~~急求大牛

zwzhaohang 2013-07-04 04:39:01
jsp页面上不兼容部分的代码:
<div id='divfile' style="background-color: white;display: none;">
<table style="WIDTH: 90%;">
<tr>
<%
String excelPath = "";
if("6200".equals(sapno))
{
excelPath="salesforecastitaly/";
}else if("6280".equals(sapno))
{
excelPath="salesforecastgerman/";
}
else if("6300".equals(sapno))
{
excelPath="salesforecastusa/";
}
else
{
excelPath="salesforecast/";
}
%>
<td style="text-align: center">
<input type="button" icon='icon-excel' value="  <bean:message key='label.downloadtemplate' />" onclick="javascript:document.location='<%=request.getContextPath()%>/console/pages/common/download.jsp?filename=<bean:message key='label.templatename' />_<%=pcycle %>.xlsx&filedir=/console/pages/basedata/<%=excelPath %>'"></input>
  <input type="button" value="  <bean:message key='label.commit' />" icon='icon-submit' onclick="importExcel();"></input>
</td>
</tr>
<tr>
<td style="text-align: center" >
<input type="text" id="fakefile" name="fakefile" size="60" readOnly> <input type="button" icon='icon-folder_open' onclick="choosefile();" value="  <bean:message key='label.choosefile' />">
</td>
</tr>
<tr>
<td id="statustd" style="text-align: center" > 
</td>
</tr>
</table>
</div>
<iframe name="upfileframe" id="upfileframe" width="0" height="0" src="<%=request.getContextPath()%>/console/pages/basedata/salesforecast/uploadImport.jsp" onload ="iframeload = true;"></iframe>
其中是一个div包含了一个table,table里有下载模板(label.downloadtemplate),提交(label.commit)以及一个文件选择功能。
当前问题是在我载入该jsp文件时firefox会自动运行下载模板功能。以及提交功能。
下面是相应的一些列的js方法
/* 导入 */
function onImport()
{
alert("000");
if(!checkAddImportDel())
{
alert("Sales forecast can only be uploaded from Monday to Wednesday.");
return;
}
var startDate = document.getElementById("startDate").value;
if(startDate=="")
{
alert("Forecast Date is mandatory.");
return;
}

$('#divfile').modal({"autoResize":true,
"onClose":function(){
if(document.frames("upfileframe").document.all.retcode.value == 'S'){
alert("123");
document.EAPForm.pageNo.value="1";
document.EAPForm.action=unieap.WEB_APP_NAME+"/salesForecast.do?method=getList";
document.EAPForm.submit();
}else{
alert("456");
this.close();
document.EAPForm.pageNo.value="1";
document.EAPForm.action=unieap.WEB_APP_NAME+"/salesForecast.do?method=getList";
document.EAPForm.submit();
}
}
});
}

/* 导入提交 */
function importExcel()
{
alert("submit")
var file = $("#fakefile").val();
if(file == "")
{
retmsg("Pls choose the file");
return;
}
var suffix = file.substring(file.lastIndexOf('.')+1,file.length);
if(suffix != 'xls' && suffix != 'XLS' && suffix!='xlsx')
{
retmsg("Pls choose xls file or xlsx file");
return;
}
$("#statustd").html("<img src='"+unieap.WEB_APP_NAME+"/console/images/ico/loading_ani.gif'></img>");
document.frames("upfileframe").OnSubmit();
}

/*选择文件*/
function choosefile()
{
if(!iframeload) return;
document.frames("upfileframe").document.EAPForm.importfile.click();
}

/* 错误反馈 */
function retmsg(msg)
{
if(!msg)
msg = document.frames("upfileframe").document.all.retmsg.value;
$("#statustd").html("<font color=red><b>" + msg + "</b></font>");
}
请各位大牛帮帮忙~~~~~
...全文
184 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
zwzhaohang 2013-07-08
  • 打赏
  • 举报
回复
真是跪求啊~~~~~~
zwzhaohang 2013-07-08
  • 打赏
  • 举报
回复
真心没有人了吗~~~~~~~~
zwzhaohang 2013-07-05
  • 打赏
  • 举报
回复
求大神出现啊~~~~~~在线等啊。
zwzhaohang 2013-07-05
  • 打赏
  • 举报
回复
我改了。还是不好用啊。另外onclick="javascript:document.location='<%=request.getContextPath()%>/console/pages/common/download.jsp?filename=<bean:message key='label.templatename' />_<%=pcycle %>.xlsx&filedir=/console/pages/basedata/<%=excelPath %>'"onclick="importExcel();这个两个方法居然在加载改jsp页面的时候就触发了。。令我很是不理解啊。
  • 打赏
  • 举报
回复
document.frames("upfileframe") 你不兼容的只是这部分吧 如果你只是一个iframe,那么直接用window.frames[0]酒可以兼容了,也可以加一个id,使用document.getElementByIdx("ifrm")
zwzhaohang 2013-07-05
  • 打赏
  • 举报
回复
坐等呢~~~大神们都干嘛去了。
roro5119 2013-07-04
  • 打赏
  • 举报
回复
好大段。。。。

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧