-1

这是我的代码表单未提交。注册未完成。请帮助我。

$(document).ready(function() {        

// validate signup form on keyup and submit
var validator = $("#signupform").validate({
    rules: {
        username: {
            required: true,
            minlength: 6,
            maxlength: 12,                      
            remote:"users.php"

        },
        password: {
            required: true,
            minlength: 6,
            maxlength: 12
        },          
        email:
        {
            required: true,
            minlength: 15,
            maxlength: 50,
            remote:"email.php"
        }
    },
    messages: {
        username: {
            minlength: "username is 6 to 12 characters",
            maxlength:  "username is 6 to 12 characters",   
            required: " username should be required",
            remote: " username should be already exists"
        },
        password: {
            minlength: "password is 6 to 15 characters",
            maxlength:  "password is 6 to 12 characters 12",        
            required: " password should be required",       
        },
        email: {
            minlength: "Email is  15 to 50 characters",
            maxlength:  "Email is  15 to 50 characters",    
            required: " Email should be required",
            remote: " Email should be already exists"           
        }
    },
             // specifying a submitHandler prevents the default submit, good for the demo       
    submitHandler: function() 
    {
        alert("submitted!---------");
        $("#signupform").submit();
    }, 
    // the errorPlacement has to take the table layout into account
    errorPlacement: function(error, element) 
            {      
        error.prependTo( element.parent().next() );
    },

    // set this class to error-labels to indicate valid fields
    success: function(label) {
        // set   as text for IE
        label.html(" ").addClass("checked");
    }
});


// propose username by combining first- and lastname
$("#username").focus(function() {
    var firstname = $("#firstname").val();
    var lastname = $("#lastname").val();
    if(firstname && lastname && !this.value) {
        this.value = firstname + "." + lastname;
    }
}); 
});

这是我的表格

<form id="signupform" name="signupform" method="post" action="register.php" style="padding-top:70px;" >             
        <table align="center" style="height:200px;">            
               <tr>             
                <td class="field"><span style="width:150px;color:black;font-weight:bold;">Username:</span>&nbsp;<input id="username" name="username" style="height:25px;width:155px;" onKeyPress='return alphanumericPass(event, false)' type="text" value="Username (6 to 12 chars)" maxlength="12" onfocus="if(this.value=='Username (6 to 12 chars)')this.value=''" onblur="if(this.value=='')this.value='Username (6 to 12 chars)'" placeholder="Username"  /></td>
                <td class=""></td>
              </tr>
              <tr>                      
                <td class="field"><span style="width:150px;color:black;font-weight:bold;">Password:</span>&nbsp;&nbsp;<input id="password" name="password" style="height:25px;width:155px;" onKeyPress='return alphanumericPass(event, false)' type="password" maxlength="12" placeholder="Password" /></td>
                <td class=""></td>
              </tr>          
              <tr>               
                <td class="field" align="left"><span style="width:150px;color:black;font-weight:bold;">Email:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input id="email" name="email" style="height:25px;width:155px;" type="text" value="Email Address"  onfocus="if(this.value=='Email Address')this.value=''" onblur="if(this.value=='')this.value='Email Address'"/></td>
                <td class=""></td>
              </tr>     
                <tr>
                    <td style="width:200px;"><div><font size="1" color="#000000">By clicking 'Register Now' you are agreeing to our <a href="terms_con.php" target="_blank" style="color:red" > Terms and Conditions </a></font></div>  </td>
                </tr>   
            <tr align="">               
                <td class="field"  align="" colspan="2" style="padding-left:70px;">         
                <input align="left" value="" id="signupsubmit" name="signup"  type="image" src="images/nsignup.png" />                      
                </td>
            </tr>
         </table>

    </form>
4

2 回答 2

0

您有一个逗号,它不应该出现在以下代码中:

   password: {
        minlength: "password is 6 to 15 characters",
        maxlength:  "password is 6 to 12 characters 12",        
        required: " password should be required",       
    },

此行末尾的逗号需要删除:required: " password should be required",

于 2013-07-29T22:17:12.503 回答
0

好吧,对于一个你没有提交输入的人。这可能是您的表单未提交的原因,因为某些浏览器无法识别图像输入类型

如果你想要的是一个带有背景图片的提交按钮,我强烈建议你只用 CSS 设置它的样式,而不是使用输入图片。

代替

<input align="left" value="" id="signupsubmit" name="signup"  type="image" src="images/nsignup.png" />

为了这

<input type="submit" name="signup" id="signupsubmit" value="">

在 CSS 中,设置样式

#signupsubmit {
    background-image: url('images/nsignup.png');
    border: none;
}
于 2013-07-29T23:46:38.763 回答