在Firefox中提交jQuery表单 [英] jQuery form submitting in firefox

查看:82
本文介绍了在Firefox中提交jQuery表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮我解决一个问题。我有这个代码,用于通过锚点提交表单。

Please, help me with one problem. I have this code, for submitting form via anchor.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            $("#btnLogout").click(function() {
                $('#frm').submit();
                return false;
            });
        });
    </script>
</head>
<body>
    <form id="frm" action="/" method="post">
        <div>
            <p>
                <label for="txtLogin">Login:</label>
                <input name="txtLogin" />
            </p>
        <div>
           <a id="btnLogout" href="javascript:void(0)">выход</a>  
        </div>
        </div>
    </form>
</body>
</html>

它适用于IE7,8,Opera和谷歌Chrome,但不适用于FireFox 3.5。
我无法理解为什么它不起作用?

It works fine on IE7,8, Opera and Google Chrome, but does not work on FireFox 3.5. I can not understand why it does not work?

推荐答案

这可能是一个与jQuery无直接关系的FF问题。尝试在动作属性中放置一个文件名,如下所示:

This may be a FF issue not related to jQuery directly. Try putting a filename in the action attribute like this:

<form id="frm" action="/index.html" method="post">

只需确保将index.html更改为您的默认文档。

Just make sure to change index.html to whatever your default document is.

这篇关于在Firefox中提交jQuery表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆