OnSubmit 在 IE 8 中不起作用
在 Internet Explorer 6 中一切正常,但在 Internet Explorer 8 中则不然。我将感谢任何人的帮助。我想知道我应该更改什么才能使其在 IE8 中运行。
这是我正在使用的代码:
<form METHOD="POST"
ENCTYPE="multipart/form-data"
name="form1"
onSubmit="checkFileUpload(this,'GIF,JPG,JPEG',false,800,'','','','','','');return document.MM_returnValue">
这是我正在使用的 javascript 代码:
<script language="JavaScript">
function checkFileUpload(form, extensions, requireUpload, sizeLimit, minWidth, minHeight, maxWidth, maxHeight) { //v2.09
document.MM_returnValue = true;
for (var i = 0; i<form.elements.length; i++) {
field = form.elements[i];
if (field.type.toUpperCase() != 'FILE') continue;
checkOneFileUpload(field, extensions, requireUpload, sizeLimit, minWidth, minHeight, maxWidth, maxHeight);
}
}
</script>
谢谢
Everything was working fine in Internet Explorer 6 but it's not in Internet Explorer 8. I will appreciate help from anybody. I want to know what I should change to make it work in IE8.
This is the code I am using in the form:
<form METHOD="POST"
ENCTYPE="multipart/form-data"
name="form1"
onSubmit="checkFileUpload(this,'GIF,JPG,JPEG',false,800,'','','','','','');return document.MM_returnValue">
This is the javascript code I am using:
<script language="JavaScript">
function checkFileUpload(form, extensions, requireUpload, sizeLimit, minWidth, minHeight, maxWidth, maxHeight) { //v2.09
document.MM_returnValue = true;
for (var i = 0; i<form.elements.length; i++) {
field = form.elements[i];
if (field.type.toUpperCase() != 'FILE') continue;
checkOneFileUpload(field, extensions, requireUpload, sizeLimit, minWidth, minHeight, maxWidth, maxHeight);
}
}
</script>
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定为什么你将其结构分为两个语句,但这可能会有所帮助:
I'm not sure why you have it structured at two statements, but this MAY help:
我注意到
checkFileUpload
定义了 8 个参数,而您使用 10 个参数来调用它。另外,最后 4 个左右看起来像数字参数,但您使用字符串来调用它。我不认为 onSubmit 不起作用;您可以通过在几个地方放置警报来验证这一点。我认为 IE8 对你的编程更加挑剔了。
我不太熟悉 Windows,但我知道 Internet 设置中有一个选项可以告诉 IE 向您报告错误。我认为你应该设置该选项。
I noticed that
checkFileUpload
is defined with 8 arguments and you're calling it with 10. Also, the last 4 or so look like numeric arguments, but you're calling it with strings.I don't think it's onSubmit that's not working; and you could verify that by putting
alert
s in a few places. I think IE8 is being a little more critical of your programming.I'm not a big Windows person, but I know there's an option in the Internet settings that tells IE to report errors to you. I think you should set that option.