个性化输入,无法重定向到其他网址

时间:2013-06-24 07:38:16

标签: html css input styles

所以,我正在尝试编辑一些个性化输入,但不知何故我无法让输入类型提交正常工作,我尝试过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;
}

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

感谢。

1 个答案:

答案 0 :(得分: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/