相关疑难解决方法(0)

JavaScript中的"提交不是函数"错误

谁能告诉我这段代码出了什么问题?我尝试使用JavaScript提交表单,但显示错误".submit不是函数".有关代码的更多详细信息,请参见下文:

<form action="product.php" method="get" name="frmProduct" id="frmProduct" enctype="multipart/form-data">

<input onclick="submitAction()" id="submit_value" type="button" name="submit_value" value="">

</form>

<script type="text/javascript">
    function submitAction()
    {
        document.frmProduct.submit();
    }
</script>
Run Code Online (Sandbox Code Playgroud)

我也试过这个:

<script type="text/javascript">
    function submitAction()
    {
        document.forms["frmProduct"].submit();
    }
</script>
Run Code Online (Sandbox Code Playgroud)

两个都显示我同样的错误:(

html javascript dom submit

248
推荐指数
6
解决办法
17万
查看次数

jQuery: form not submitting with $("#id").submit(), but will submit with a 'submit' button?

<form method="post" action="load_statements.php?action=load" id="loadForm"
                            enctype="multipart/form-data">
Run Code Online (Sandbox Code Playgroud)

that is my form, which looks fine to me. in that form, i put this button:

<input type="button" name="submit" id="submit" value="Submit" onclick="confirmSubmit()" class="smallGreenButton" />
Run Code Online (Sandbox Code Playgroud)

here is the function it calls:

function confirmSubmit() {
    // get the number of statements that are matched
    $.post(
        "load_statements.php?action=checkForReplace",
        {
            statementType : $("#statementType").val(),
            year : $("#year").val()
        },
        function(data) {
            if(data['alreadyExists']) {
                if( confirm("Statements already exist for " + $("#statementType").html() + " " + $("#year").val() +
                    ". Are you sure you …
Run Code Online (Sandbox Code Playgroud)

forms jquery form-submit

38
推荐指数
4
解决办法
8万
查看次数

标签 统计

dom ×1

form-submit ×1

forms ×1

html ×1

javascript ×1

jquery ×1

submit ×1