0

所以,我正在尝试编辑一些个性化的输入,但不知何故我无法让输入类型提交正常工作,我尝试过 onclick=blabla 重定向并尝试将其与重定向功能相关联,到目前为止没有,留下在同一页上。

i.imgur.com/265RGMu.jpg

这是表格

    <form method="post" id="fields">
    <input type="text" id="username" name="username">
    <input type="password" id="password" name="password" >
    <input type="submit" value="Log in">
    <input type="submit" value="Register">
    <input type="submit" value="Lost Password">

这是它的CSS:

 #fields {
    width: 220px;
    height: 155px;
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -110px;
    margin-top: -75px;

    -webkit-animation: login 1s ease-in-out;
    -moz-animation: login 1s ease-in-out;
    animation: login 1s ease-in-out;
}

#fields input[type="text"],
#fields input[type="password"] {
    width: 100%;
    height: 40px;
    margin-top: 7px;
    font-size: 14px;
    color: #444;
    outline: none;
    border: 1px solid rgba(0, 0, 0, .49);

    padding-left: 20px;

    -webkit-background-clip: padding-box;
    -moz-background-clip: padding-box;
    background-clip: padding-box;
    border-radius: 6px;

    background-image: -webkit-linear-gradient(bottom, #FFFFFF 0%, #F2F2F2 100%);
    background-image: -moz-linear-gradient(bottom, #FFFFFF 0%, #F2F2F2 100%);
    background-image: -o-linear-gradient(bottom, #FFFFFF 0%, #F2F2F2 100%);
    background-image: -ms-linear-gradient(bottom, #FFFFFF 0%, #F2F2F2 100%);
    background-image: linear-gradient(bottom, #FFFFFF 0%, #F2F2F2 100%);

    -webkit-box-shadow: inset 0px 2px 0px #d9d9d9;
    box-shadow: inset 0px 2px 0px #d9d9d9;

    -webkit-transition: all .1s ease-in-out;
    -moz-transition: all .1s ease-in-out;
    transition: all .1s ease-in-out;
}

#fields input[type="text"]:focus,
#fields input[type="password"]:focus {
    -webkit-box-shadow: inset 0px 2px 0px #a7a7a7;
    box-shadow: inset 0px 2px 0px #a7a7a7;
}

#fields input:first-child {
    margin-top: 0px;
}

#fields input[type="submit"] {
    width: 100%;
    height: 50px;
    margin-top: 7px;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0px -1px 0px #5b6ddc;
    outline: none;
    border: 1px solid rgba(0, 0, 0, .49);

    -webkit-background-clip: padding-box;
    -moz-background-clip: padding-box;
    background-clip: padding-box;
    border-radius: 6px;
    background-color: #5466da;
    background-image: -webkit-linear-gradient(bottom, #5466da 0%, #768ee4 100%);
    background-image: -moz-linear-gradient(bottom, #5466da 0%, #768ee4 100%);
    background-image: -o-linear-gradient(bottom, #5466da 0%, #768ee4 100%);
    background-image: -ms-linear-gradient(bottom, #5466da 0%, #768ee4 100%);
    background-image: linear-gradient(bottom, #5466da 0%, #768ee4 100%);

    -webkit-box-shadow: inset 0px 1px 0px #9ab1ec;
    box-shadow: inset 0px 1px 0px #9ab1ec;

    cursor: pointer;

    -webkit-transition: all .1s ease-in-out;
    -moz-transition: all .1s ease-in-out;
    transition: all .1s ease-in-out;
}

#fields input[type="submit"]:hover {
    background-color: #5f73e9;
    background-image: -webkit-linear-gradient(bottom, #5f73e9 0%, #859bef 100%);
    background-image: -moz-linear-gradient(bottom, #5f73e9 0%, #859bef 100%);
    background-image: -o-linear-gradient(bottom, #5f73e9 0%, #859bef 100%);
    background-image: -ms-linear-gradient(bottom, #5f73e9 0%, #859bef 100%);
    background-image: linear-gradient(bottom, #5f73e9 0%, #859bef 100%);

    -webkit-box-shadow: inset 0px 1px 0px #aab9f4;
    box-shadow: inset 0px 1px 0px #aab9f4;
    margin-top: 10px;
}

浪费了整整几个小时试图解决这个问题,

谢谢。

4

1 回答 1

1

我不明白你的问题。我认为您对网站结构的想法不是最好的。您可以使用链接而不是按钮来“重定向”到注册页面或其他任何内容。您可以像按钮一样设置它们的样式。

如果要将表单的输入发送到目标页面,可以使用 JS 中的重定向来实现。但是您只能提供用户名。密码将在 URL 中以纯文本形式发送。示例(使用 Button-Type 而不是提交):

<form id="fields" action="login.html">
  <input id="user" type="text" name="username" value="" /><br />
  <input type="password" name="password" value="" /><br /> 
  <input type="submit" name="login" value="Log in" /><br />
  <input type="button" value="Register" onclick="redirect_loginfrom('register')"/><br />
 <input type="button" value="Lostpassword" onclick="redirect_loginfrom('lostpassword')" /><br />
</form>

在此处查看完整来源:http: //jsfiddle.net/BmYck/2/

于 2013-06-24T10:45:03.847 回答