我在表单提交中调用了 js 函数...除了 IE6 之外所有浏览器都工作正常
function createTemplate() {
createformlayers(x, y,z);
windowResizeRefresh() ;
}
Layers1.text(x,y,z)
{
//some codes go here
}
function createformlayers(eid)
{
var newdiv = document.createElement('div');
newdiv.setAttribute("id",eid);
newdiv.innerhtml ='<form action="javascript:Layers1.text('test',200,200)"></form>';
}
function windowResizeRefresh() {
for (var n = 0; n < Layers.length; n++) {
fid = 'form' + n;
document.getElementById(fid).submit();
}
}
<body onload="createTemplate()">
function createTemplate() {
createformlayers(x, y,z);
windowResizeRefresh() ;
}
Layers1.text(x,y,z)
{
//some codes go here
}
function createformlayers(eid)
{
var newdiv = document.createElement('div');
newdiv.setAttribute("id",eid);
newdiv.innerhtml ='<form action="javascript:Layers1.text('test',200,200)"></form>';
}
function windowResizeRefresh() {
for (var n = 0; n < Layers.length; n++) {
fid = 'form' + n;
document.getElementById(fid).submit();
}
}
<body onload="createTemplate()">
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将 IE 配置为在遇到错误时向您显示警告。此警告可能会为您提供有关失败原因的线索。对话框上还有一个上一个按钮,如果存在多个错误,则该按钮非常有用,之前的错误往往需要先解决。
如果您在同一台计算机上安装了 Microsoft Office。您可以在 Office 设置中(在“添加/删除程序”下)添加/删除“脚本调试”的共享/杂项工具。这是 IE6 最好的调试器。 (除非您已经有 MS Visual Studio,否则我认为这是相同的,但我没有 Visual Studio,所以我不知道该怎么做)。
使用此脚本调试器,您可以打开调试器并设置断点并单步执行代码并检查发生了什么。您还可以直接从 JavaScript 错误启动调试器并检查变量/DOM/调用堆栈等。
You can configure IE to show you a warning whenever it encounters an error. This warning may give you a clue as to what is failing. There is also a previous button on the dialog that is useful if there are multiple errors, the previous ones tend to need solving first.
If you have Microsoft Office on the same machine. You can add/remove shared/misc tools in the Office setup (under add/remove programs) for "Script Debugging". This is the best debugger you can get for IE6. (Unless you have MS Visual Studio already, I think this is identical, but I don't have Visual Studio, so I'm not sure how to do that).
With this script debugger, you can open the debugger and set breakpoints and step-through your code and inspect what's going on. You can also launch the debugger directly from a JavaScript error and inspect the variables/DOM/call stack, etc.
哎哟!刚刚意识到,您正在使用 action 属性,在 IE6 中,该属性很可能被限制为 512 个字符(包括“javascript:”)!
为什么不把所有这些都放在一个函数中呢?并且有
action="javascript:doAction(); void 0"
或者其他什么?Doh! Just realized, you're using the action attribute, which in IE6, may well be limited to something like 512 Characters (including the "javascript:")!!!
Why don't you stick all that in a function? And have
action="javascript:doAction(); void 0"
or something?