[英]Why won't this Javascript code execute in Firefox & Chrome?
I have this set of Javascript code that works fine in IE (any version), but won't work on Mozilla Firefox or Google Chrome. 我有这套Javascript代码,可以在IE(任何版本)中正常工作,但在Mozilla Firefox或Google Chrome上无法使用。 Can someone advise me why?
有人可以告诉我为什么吗?
function returnData(strCode,strProgramCode,strName)
{
parent.opener.document.all.txtCourseCode[7].value = strCode;
parent.opener.document.all.txtProgram[7].value = strProgramCode;
parent.opener.document.getElementById("txtCourseName8").innerHTML = strName;
window.close()
}
FYI, this Javascript is embedded into a .aspx page that was written using .NET Framework 1.1. 仅供参考,此Javascript嵌入使用.NET Framework 1.1编写的.aspx页中。
Edit Doesn't work means: none of the lines executed although they were explicitly invoked. 编辑不起作用意味着:尽管显式调用了任何行,但均未执行。
Example: window.close()
doesn't close the window 示例:
window.close()
不关闭窗口
document.all
is an IE-only property, so obviously it won't work in other browsers. document.all
是仅IE的属性,因此显然在其他浏览器中将无法使用。
You shouldn't use document.all
anyway. 无论如何,您都不应该使用
document.all
。 By the look of things, you're actually wanting: 从外观上看,您实际上想要的是:
parent.opener.document.getElementsByName('txtCourseCode')[7].value = strCode;
parent.opener.document.getElementsByName('txtProgram')[7].value = strProgramCode;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.