OnSubmit 在 IE 8 中不起作用

发布于 2024-08-11 07:48:04 字数 875 浏览 6 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

自此以后,行同陌路 2024-08-18 07:48:04

我不确定为什么你将其结构分为两个语句,但这可能会有所帮助:

onSubmit="function() {checkFileUpload(this,'GIF,JPG,JPEG',false,800,'','','','','','');return document.MM_returnValue;}"

I'm not sure why you have it structured at two statements, but this MAY help:

onSubmit="function() {checkFileUpload(this,'GIF,JPG,JPEG',false,800,'','','','','','');return document.MM_returnValue;}"
梦明 2024-08-18 07:48:04

我注意到 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 alerts 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文