Bootstrap表单不起作用

时间:2014-07-28 14:19:35

标签: css forms twitter-bootstrap submit

请我尝试使用bootstrap来改变我的网站外观然而当我尝试更改我的登录页面的形式时,它似乎在我点击提交时加载,但什么也没做。任何帮助!!

旧代码:

<form method="post" name="login" action="">
<table align="center">
<tr><td>
    <table align="center">
            <tr>
               <td align="right"><font face="Arial,Helvetica" size="-1"><strong>Username:</strong></font></td>
               <td align="left"><input type="text" name="username"></td>
            </tr>
            <tr>
               <td align="right" width="30%"><font face="Arial,Helvetica" size="-1"><strong>Password:</strong></font></td>
               <td align="left"><input type="password" name="password"></td>
            </tr>
    </table>
</td></tr>
<tr><td>
    <center><input type="submit" name="Submit" value="Login"></center>
</td></tr>
</table>
</form>

新代码:

<div class="container">

<form class="form-signin" role="form"  method="post" name="login" action="">
   <h2 class="form-signin-heading">Please sign in</h2>
    <input type="text" class="form-control" placeholder="Username" required autofocus>
    <input type="password" class="form-control" placeholder="Password" required>
    <div class="checkbox">
      <label>
        <input type="checkbox" value="remember-me"> Remember me
      </label>
    </div>
    <!--center><input class="btn btn-lg btn-primary btn-block" type="submit" name="Submit" value="Login"></center-->
    <button class="btn btn-lg btn-primary btn-block" type="submit" name="Submit" value="Login">Sign in</button>
</form>

</div> <!-- /container -->

2 个答案:

答案 0 :(得分:1)

好像您忘记了name中的input属性,试试这个:

<div class="container">    
<form class="form-signin" role="form"  method="post" name="login" action="">
   <h2 class="form-signin-heading">Please sign in</h2>
    <input name="username" type="text" class="form-control" placeholder="Username" required autofocus>
    <input name="password" type="password" class="form-control" placeholder="Password" required>
    <div class="checkbox">
      <label>
        <input type="checkbox" value="remember-me"> Remember me
      </label>
    </div>
    <!--center><input class="btn btn-lg btn-primary btn-block" type="submit" name="Submit" value="Login"></center-->
    <button class="btn btn-lg btn-primary btn-block" type="submit" name="Submit" value="Login">Sign in</button>
</form>

</div> <!-- /container -->

答案 1 :(得分:0)

<form method="post" name="login" action="">

您是否故意将行动留空?如果没有动作发布,当然它什么都不做。