原文地址:http://blog.sina.com.cn/s/blog_608105cb0100se9l.html

今天朋友问到我一个问题,a标签如何提交表单,我当时想用form.submit()嘛,结果他说IE6下会出现此方法不起作用,我其实还真没遇到过,回家试试了下,网上一查还真有这么回事。

<form action="" method="POST" ></form>

原因:

微软的东西总是喜欢异步处理,那么就有这样的可能:写入数据的函数返回并执行下面的submit(),但是实际上在IE内部并没有完成整个过程,从而导致submit()失败。

 

解决办法:

<script type="text/javascript">
function form_submit()
{
 setTimeOut(do_submit,0);
//do_submit 和 0 之间的逗号中间不能有空格的!
}
function do_submit()
{
$("#form1").submit();
}
</script>

原文地址:http://blog.sina.com.cn/s/blog_608105cb0100se9l.html

参考:

http://blog.hierick.com/javascript-form-submit-ie6.html

http://hi.baidu.com/swustnjtu/blog/item/4c4b07a8724415e61e17a2ea.html

相关文章:

  • 2022-12-23
  • 2021-04-21
  • 2022-12-23
  • 2021-12-28
  • 2021-12-02
  • 2021-09-08
猜你喜欢
  • 2021-12-27
  • 2021-08-11
  • 2021-10-28
  • 2022-12-23
  • 2022-03-04
  • 2022-12-23
  • 2021-10-17
相关资源
相似解决方案