所以,我试图编辑一些个性化的输入,但不知何故,我无法使输入类型submit正常工作,我尝试了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;
}
花了整整几个小时试图解决这个问题,
谢谢。
我不明白你的问题。我认为你对网站结构的看法不是最好的。你可以使用链接而不是按钮来"重定向"到注册页面或其他什么。你可以像你的按钮一样设计它们的样式。
如果你想把表单的输入发送到目的页面,你可以用JS重定向。但您只能提供用户名。密码将以纯文本形式在URL中发送。示例(使用按钮类型而不是提交):
<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/