关于在Form表单中出现多个Button但是Button失效的问题

  • Post author:
  • Post category:其他


代码如下:

<form action="success.php" method="post">
    <input type="text" name="username">
    <input type="password" name="password">
    <button type="submit" name="submit">注册</button>
    <a href="login.php"><button>登陆</button></a>
    </form>
    <form action="success.php" method="post">
    <input type="text" name="username">
    <input type="password" name="password">
    <button type="button" name="submit">注册</button>
    <a href="login.php"><button type="button">登陆</button></a>
    </form>

在这两种情况下,点击登录button是不会有反应的,正确代码应该如下:

<form action="success.php" method="post">
    <input type="text" name="username">
    <input type="password" name="password">
    <button type="submit" name="submit">注册</button>
    <a href="login.php"><button type="button">登陆</button></a>
    </form>



版权声明:本文为lu10505原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。