0

我有以下表格适用于 IE7 和所有 Safari、Chrome、Firefox,但不适用于 IE8 和 IE9。它正确显示了成功消息,但实际上并未提交任何内容。

我想知道是否有人知道解决方案?

这是我的表格和脚本;

<div id="successMessage" style="display:none;"><p>Thank you for contacting Fussey Engineering. We will contact you within 2 business days.</p></div>

<form method="post" action="" id="contactform">

<label for=name accesskey=U><span class="required">*</span> Your Name</label>
<input name="name" type="text" id="name" size="30" value="" />

<br />
<label for=email accesskey=E><span class="required">*</span> Email</label>
<input name="email" type="text" id="email" size="30" value="" />

<br />
<label for=phone accesskey=P><span class="required">*</span> Phone Number</label>
<input name="phone" type="text" id="phone" size="30" value="" />

<br />

<label for=comments accesskey=C><span class="required">*</span> Your Comments</label>
<textarea name="comments" cols="26" rows="8" id="comments"></textarea>

<hr />

<p style="margin:0px; padding:0px;"><span class="required">*</span>Are You Human?</p>

<label for=verify accesskey=V>3 + 1 =</label>
<input name="verify" type="text" id="verify" size="6" value="" />

<input name="contactus" type="submit" class="submit" id="contactus" value="Submit" />

</form>
<script type="text/javascript">
$(document).ready(function () {

    $.validator.addMethod("verify", function (value, element, params) {
        return value == params[0] + params[1];
    }, jQuery.validator.format("Please enter the correct value for {0} + {1}"));

    $("#contactform").validate({

        success: function(label) {
                label.hide();
        },
        rules: {
            name: {required: true},
            email: {
              email: true,
              required: true
            },
            phone: {
              required: true,
              digits: true
            },
            comments: {required: true},
            verify:{
              verify:[3, 1]
            }
        },
        messages: {
            name: "Please tell us your Name",
            email: "Please enter a valid email address",
            phone: "Please enter a valid phone number",
            comments: "Please enter your comments"
        },
        submitHandler: function(form) {
            $("#contactform").ajaxSubmit({
              success:function(e){
                $("#successMessage").show();
              }
            });
            return false;
        }
    });

});
</script>
4

0 回答 0