【问题标题】:JQueryMobile Can NOT manually submit Form in Internet Explorer 8?JQueryMobile 不能在 Internet Explorer 8 中手动提交表单?
【发布时间】:2012-12-03 10:37:31
【问题描述】:

所有,

我发现我无法使用 JQueryMobile 1.2 在 Internet Explorer 8 中手动提交表单。

HTML代码如下,简单:

<HTML>
<HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test</title>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
  <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
  <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>

<body>
<form method="post" name="test" action="http://www.baidu.com/" data-ajax="false">
  <input type="text" id="id_0" name="id_0" size="20" maxlength="32" value="PLAY"/>
  <input type="text" id="id_1" name="id_1" size="20" maxlength="32" value="PLAY"/>

<input data-theme="b" type="submit" value="OK" id="basicSubmit"/>
</form>  

</body>
</html>

我将此页面保存到本地磁盘并在 Internet Explorer 8 中打开它,它将显示 2 个文本和一个提交按钮。但是当点击“确定”按钮时,什么也没有发生。

如果我删除包含 jquery.mobile-1.2.0.min.js 的 script 标签行:

<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>

jquerymobile 样式消失(没关系),“确定”按钮变为可点击提交。 (虽然此表单的 URL 不正确并且 IE 显示错误消息)。 我也试过“data-ajax=true”或者“data-ajax=false”,都失败了。

有人可以帮忙吗?非常感谢。

【问题讨论】:

  • 如果form action 错了,那么它不会去任何地方。
  • 其实我在我的页面中使用了正确的action,在Chrome/FireFox下可以提交,在IE下不行。这里不正确的操作仅用于示例。

标签: jquery forms internet-explorer jquery-mobile


【解决方案1】:

我遇到了同样的问题,提交按钮在 IE9 中不起作用。我用

替换了提交按钮
<input type="button" id="Signup" value="Signup!" data-role="" onClick="submitForm()">

并添加了功能:

    function submitForm() {
    document.registerForm.submit();
    }

这解决了我的问题。

【讨论】:

    【解决方案2】:

    请参考this link。此问题已在上面的链接中修复,您只需对该页面中给出的 CSS 进行一些更改。

    【讨论】:

    • 谢谢。这个问题与错误不同。该错误应该已在 JQueryMobile 1.2 中修复。
    • 我发现我应该将 添加到这个 HTML 文件的头部。如果添加,IE 可以通过单击提交按钮提交此 FORM。好奇怪。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-19
    • 2012-02-17
    • 2010-09-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多