为什么我的表单没有提交或发布

时间:2015-10-06 03:50:54

标签: javascript jquery html forms

表单未使用connector.php提交或发布到数据库。我试过删除验证无济于事我不知道有什么问题。这个问题一直困扰着我一两天。请帮助别人。

`                                   

<title>Sign up</title>
<link href="css/alldatcookies.css" rel="stylesheet" type="text/css" />
</head>

<body>
<nav class="nav ssm-nav-visible">
        <img src="img/swipe.png" alt="swipe image" width="73" height="85" align="right" />
        <p><img src="seventhswellicon10.png" width="178" height="169" align="middle" /></p>

           <ul>
<li><a class="" href="">Home</a></li>
<li><a href="">Login</a></li>
<li><a href="SignUp.html">Sign Up</a></li>
<li><span style="color: #FFFFFF"></span><a href="">Contact</a></li>
</ul>
</nav>

<form id="msform" name="msform" onSubmit="return checkForm(this)"         action="connector.php" method="POST" >
<a href="#" style="color:#FFFFFF" class="ssm-open-nav" title="open nav">Menu</a>
<ul id="progressbar">
    <li class="active">Account Setup</li>
    <li> Profile</li>
    <li>Personal Details</li>
    </ul>
    <fieldset>
    <h2 class="fs-title">Create your account</h2>
    <h3 class="fs-subtitle">Step 1</h3>
        <input id="username" name="username" placeholder="In Game Username"/>
    <input id="email" name="email" placeholder="email"/>
    <br />
    <input type="password" id="pass" name="pass" placeholder="Password" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}"onchange="form.cpass.pattern = this.value;">
   <br />   
   <input type="password" id="cpass" name="cpass" placeholder="Confirm Password" onKeyUp="checkPass(); return false;"  pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}"/> <br />
    <input type="button" name="next" class="next action-button" value="Next" />
    </fieldset> <fieldset><h2 class="fs-title">Social Profiles</h2>
    <h3 class="fs-subtitle">Your presence on the social network</h3>
    <input type="text" name="twitter" placeholder="Twitter" />
    <input type="text" name="facebook" placeholder="Facebook" />
    <input type="text" name="gplus" placeholder="Google Plus" />
    <input type="button" name="previous" class="previous action-button" value="Previous" />   <input type="button" name="next" class="next action-button" value="Next" />   </fieldset>
    <fieldset>
    <h2 class="fs-title">Personal Details    </h2>
     <input type="text" id="firstname" name="firstname" placeholder="First Name" value="" /><br />
      <br />
    <input type="text" id="lastname" name="lastname" placeholder="Last Name" />
     <br />
     <input type="tel" id="phone" name="phone" placeholder="Phone" />
     <br />
     </textarea> 
      <input type="button" name="previous" class="previous action-button" value="Previous" />
      <input type="submit" name="submit" id="msform"class="submit action-button" value="Submit"/>
      </fieldset>
      </form>
      <script language="javascript">function validateForm()
      {
      var x=document.forms["msform"]["firstname"].value;
      if (x==null || x=="")
      {
      writeError("First name must be filled out");
      return false;  }
      return true
      }
      function validateForm()
      {
      var x=document.forms["msform"]["lastname"].value;
      if (x==null || x=="")
      {
      writeError("Last name must be filled out");
      return false;
      }
      return true
      }
      function validateForm() 
      {re = /[1-10]/;
      var x=document.forms["msform"]["phone"].value;
      if (x==null || x=="")
      {
      writeError("Phone number must be filled out");
      return false;
      }
      else
      {
      if(!re.test(document.forms["msform"]["phone"].value)) {
       writeError("Phone must at least contain 10 numbers ex. 1234567890!");
      document.forms["msform"]["phone"].focus();
      return false;
      }
      return true
      }
      }
      function validateForm()
      {
      var x=document.forms["msform"]["username"].value;
      if (x==null || x=="")
      {
      writeError("Username must be filled out");
       return false;
       }
       re = /^\w+$/;
       if(!re.test(document.forms["msform"]["username"].value)) {
       $(this).w2tag.alert("Username must contain only letters, numbers and     underscores!");
       document.forms["msform"]["username"].focus();
       return false;
       }
       return true
       }
       function validateForm()
       {
       var x=document.forms["msform"]["email"].value;
       var atpos=x.indexOf("@");
       var dotpos=x.lastIndexOf(".");
       if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
       {
        writeError("Not a valid e-mail address");

          return false;
        }
        return true

        }

        function checkPass()

        {

        //Store the password field objects into variables ...

        var pass1 = document.getElementById('pass');

        var pass2 = document.getElementById('cpass');

        //Store the Confimation Message Object ...

        var message = document.getElementById('confirmMessage');

        //Set the colors we will be using ...

        var goodColor = "#66cc66";

        var badColor = "#ff6666";

        //Compare the values in the password field 

        //and the confirmation field

        if(pass1.value == pass2.value){

        //The passwords match. 

        //Set the color to the good color and inform

        //the user that they have entered the correct password 

        pass2.style.backgroundColor = goodColor;

        message.style.color = goodColor;

        message.w2tag = "Passwords Match!";

        }else{

        return false

        {

        //The passwords do not match.

       //Set the color to the bad color and

 //notify the user.

        pass2.style.backgroundColor = badColor;

        message.style.color = badColor;

        message.w2tag = "Passwords Do Not Match!";

        }

        return true

        } 

        }

        </script> 

        <style type="text/css">

        {}options: {

        css    : {,    ;// css rules for input

        class  : '',    ;// class name for input

        onShow : null,  ;// function to execute when overlay is shown 

        onHide : null   ;// function to execute when overlay is hidden 

        }

        </style>

        <!-- jQuery -->


     <script src="Javascript/jquery-2.1.0.min.js" type="text/javascript">                     </script>


        <!-- jQuery easing plugin -->
        <script src="Javascript/jquery.easing.min.js" type="text/javascript"></script>

        <script src="css/cookiemonster.js" type="text/javascript"></script>                 

     <script 

             src="http://labs.rampinteractive.co.uk/touchSwipe/jquery.touchSwipe.min.js">  

   </script>

    <script src="jquery.slideandswipe.min.js"></script>

    <div class="ssm-overlay"></div>


    <script>

       $(document).ready(function() {

            $('.nav').slideAndSwipe();

     });

         </script>



      </body>

      </html>`

1 个答案:

答案 0 :(得分:0)

您的脚本中似乎没有任何内容可以激活它。通常,您希望脚本以单击或类似的方式启动...您的代码似乎没有任何事件来触发函数。

看看这个site,它演示了如何使用.addEvent启用提交按钮。