如何将动作固定到按钮上

时间:2014-02-12 18:03:35

标签: php html css css3

这是我的index.html。我想在点击按钮时采取行动checklogin.php。这就是我制作但它在按钮上显示文字。我应该在哪里粘贴我的动作?有人能给我一个建议吗?

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" type="text/css" href="logs.css" />
</head>

<body>
    <div class="container">
        <form id="signup">
            <div class="header">
                 <h3>Logowanie</h3>

            </div>
            <div class="sep"></div>
            <div class="inputs">
                <input type="myusername" placeholder="Login" autofocus />
                <input type="mypassword" placeholder="Hasło" /> <a id="submit">
            <form name="form1" method="post" action="check.php">
            <input type="submit" name="Submit" value="OK"> </form> Zaloguj </a>

            </div>
        </form>
    </div>
</body>
</html>

这是我的css:

#signup .inputs #submit {
    width: 100%;
    margin-top: 20px;
    padding: 15px 0;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 1px;
    text-align: center;
    text-decoration: none;
    background: -moz-linear-gradient(top, #b9c5dd 0%, #a4b0cb);
    background: -webkit-gradient(linear, left top, left bottom, from(#b9c5dd), to(#a4b0cb));
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    border: 1px solid #737b8d;
    -moz-box-shadow: 0px 5px 5px rgba(000, 000, 000, 0.1), inset 0px 1px 0px rgba(255, 255, 255, 0.5);
    -webkit-box-shadow: 0px 5px 5px rgba(000, 000, 000, 0.1), inset 0px 1px 0px rgba(255, 255, 255, 0.5);
    box-shadow: 0px 5px 5px rgba(000, 000, 000, 0.1), inset 0px 1px 0px rgba(255, 255, 255, 0.5);
    text-shadow: 0px 1px 3px rgba(000, 000, 000, 0.3), 0px 0px 0px rgba(255, 255, 255, 0);
    display: table;
    position: static;
    clear: both;
}

1 个答案:

答案 0 :(得分:0)

Live Demo

首先,这是有效的HTML

<div class="container">
  <form name="form1" method="post" action="check.php">
    <div class="header">
         <h3>Logowanie</h3>
    </div>
    <div class="sep"></div>
    <div class="inputs">
        <input type="myusername" placeholder="Login" autofocus />
        <input type="mypassword" placeholder="Hasło" /> 
        <a id="submit" href="#">Zaloguj </a>
    </div>
  </form>
</div>

其次,如果您需要连接链接,请执行此操作

window.onload=function() {
  document.getElementById("submit").onclick=function() {
    document.form1.submit();
    return false;
  }
}

第三,你只需要在CSS上

#submit {