按钮似乎不可点击

时间:2015-04-18 07:09:26

标签: html button submit

我抓住了一个登录页面模板,在我的网站上实现,并根据登录页面模板创建了一个注册页面。我遇到了实际按钮点击的问题。当我将鼠标悬停在按钮上时,它会改变颜色,但当您将鼠标悬停在链接/按钮上时,鼠标指针不会切换手指。当我点击按钮时没有任何反应。我有一个php文件设置来检查字段,然后将信息提交到数据库中。这是代码:

<!DOCTYPE html>
<html>

<head>

  <meta charset="UTF-8">

  <title>Register</title>

  <link rel="stylesheet" href="assets/css/login_register.css">

</head>

<body>

  <html lang="en-US">

  <head>

    <meta charset="utf-8">

    <title>Register</title>

    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,700">

    <!--[if lt IE 9]>
      <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
     <![endif]-->

  </head>

  <body>

    <div class="container">

      <div id="login">

        <form action="javascript:void(0);" method="post" action="register.php" autocomplete="on">

          <fieldset class="clearfix">

            <p><span class="fontawesome-user"></span>
              <input id="first_name" name="first_name" type="text" value="First Name" onBlur="if(this.value == '') this.value = 'First Name'" onFocus="if(this.value == 'First Name') this.value = ''" required>
            </p>
            <!-- JS because of IE support; better: placeholder="Username" -->

            <p><span class="fontawesome-user"></span>
              <input id="last_name" name="last_name" type="text" value="Last Name" onBlur="if(this.value == '') this.value = 'Last Name'" onFocus="if(this.value == 'Last Name') this.value = ''" required>
            </p>

            <p><span class="fontawesome-envelope"></span>
              <input id="email" name="email" type="text" value="Email" onBlur="if(this.value == '') this.value = 'Email'" onFocus="if(this.value == 'Email') this.value = ''" required>
            </p>

            <p><span class="fontawesome-user"></span>
              <input id="username" name="username" type="text" value="Username" onBlur="if(this.value == '') this.value = 'Username'" onFocus="if(this.value == 'Username') this.value = ''" required>
            </p>

            <p><span class="fontawesome-lock"></span>
              <input id="password" name="password" type="password" value="Password" onBlur="if(this.value == '') this.value = 'Password'" onFocus="if(this.value == 'Password') this.value = ''" required>
            </p>

            <p><span class="fontawesome-lock"></span>
              <input id="confirm_password" name="confirm_password" type="password" value="Password" onBlur="if(this.value == '') this.value = 'Password'" onFocus="if(this.value == 'Password') this.value = ''" required>
            </p>

            <!-- JS because of IE support; better: placeholder="Password" -->

            <p>
              <input type="submit" value="Register">
            </p>

          </fieldset>

        </form>

      </div>
      <!-- end login -->

    </div>

  </body>

  </html>

</body>

</html>

2 个答案:

答案 0 :(得分:0)

使用

<form method="post" action="register.php" autocomplete="on">

错误是<form action="javascript:void(0);" method="post" action="register.php" autocomplete="on">

形式的两个操作属性

答案 1 :(得分:0)

我重写了编码。你可以使用它们。我删除了多个操作。我使用占位符代替 value =&#34;用户名&#34; onBlur =&#34; if(this.value ==&#39;&#39;)this.value =&#39;用户名&#39;&#34; onFocus =&#34; if(this.value ==&#39;用户名&#39;)this.value =&#39;&#39;&#34; 。此外,我们不得使用 value =&#34;名字&#34; 。现在您已经编写了所有值。它会影响表单验证。

<!DOCTYPE html>

注册

<meta charset="utf-8">

<title>Register</title>

<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,700">

<!--[if lt IE 9]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
 <![endif]-->

<div class="container">

  <div id="login">

    <form method="post" action="register.php" autocomplete="on">

      <fieldset class="clearfix">

        <p><span class="fontawesome-user"></span>
          <input id="first_name" name="first_name" type="text" placeholder="First Name" required />
        </p>
        <!-- JS because of IE support; better: placeholder="Username" -->

        <p><span class="fontawesome-user"></span>
          <input id="last_name" name="last_name" type="text" placeholder="Last Name" required />
        </p>

        <p><span class="fontawesome-envelope"></span>
          <input id="email" name="email" type="text" placeholder="Email" required />
        </p>

        <p><span class="fontawesome-user"></span>
          <input id="username" name="username" type="text" placeholder="Username" required />
        </p>

        <p><span class="fontawesome-lock"></span>
          <input id="password" name="password" type="password" placeholder="Password" required />
        </p>

        <p><span class="fontawesome-lock"></span>
          <input id="confirm_password" name="confirm_password" type="password"  placeholder="Confirm Password" required />
        </p>

        <!-- JS because of IE support; better: placeholder="Password" -->

        <p>
          <input type="submit" value="Register" />
        </p>

      </fieldset>

    </form>

  </div>
  <!-- end login -->

</div>