I called js function in form submit...all browsers working fine except IE6
function createTempla开发者_开发百科te() {
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()">
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.
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?
精彩评论