未捕获的TypeError:当我尝试document.index.submit()时,对象不是函数错误。

时间:2015-01-06 05:46:48

标签: form-submit typeerror

<form role="form" class="register-form cf-style-1" name="index" action="#" method="post">
                    <div class="field-row">
                        <label>First Name: *</label>
                        <input type="text" name="firstName" class="le-input">
                        <label>Last Name: *</label>
                        <input type="text" name="lastName" class="le-input">
                        <label>Email: *</label>
                        <input type="text" name="email" class="le-input">
                        <input type="hidden" name="dbAction">
                        <label>Mobile Number: *</label>
                        <input type="text" name="mobileNumber" class="le-input">
                        <label>Create Password: *</label>
                        <input type="password" name="createPassword" class="le-input">
                        <label>Confirm Password: *</label>
                        <input type="password" name="confirmPassword" class="le-input">
                    </div><!-- /.field-row -->

                    <div class="buttons-holder">
                        <button type="button" name="submit" onclick="validatePageData();" class="le-button huge">Sign Up</button>
                    </div><!-- /.buttons-holder -->
                </form>

<script>
    function validatePageData() {document.index.submit();
  }`

1 个答案:

答案 0 :(得分:0)

document.forms[name ="index"].submit()应该有用。