html网页设计:一个简单的登录界面代码!

在html网页设计中,一个“登录”按钮怎么编写代码?列如所给图片的“登录”按钮怎么用html代码显示出来,要求能够识别是否输入用户名和密码!... 在html网页设计中,一个“登录”按钮怎么编写代码?
列如所给图片的“登录”按钮怎么用html代码显示出来,要求能够识别是否输入用户名和密码!
展开
 我来答
a3476012
推荐于2017-09-07 · TA获得超过1267个赞
知道小有建树答主
回答量:484
采纳率:87%
帮助的人:113万
展开全部
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href="main.css" type="text/css" rel="stylesheet">
<title>登陆界面</title>
</head>

<body>
<div class="login_ico">
<img src="images/login_ico.png">
</div>
<div class="login_putin">
<ul>
<li><input type="text" ></li>
<li><input type="password" ></li>
</ul>
</div>
<div class="login_btn">
<input type="submit" value="登陆">
</div>
</body>
</html>
样式 :

*{
margin:0;
padding:0;}

li{
list-style-type:none;
margin:0;
padding:0;}
a{
text-decoration:none;
color:#000;}

/*---------------------按钮-----------------------------*/
.login_putin ul li input{
margin: 0;
width:70%;
padding: 1em 2em 1em 5.4em;
-webkit-border-radius:.3em;
-moz-border-radius: .3em;
border: 1px solid #999;
}

.login_btn{
width:300px;
margin:40px auto 0 auto;
}

.login_btn input{
width:100%;
margin:0;
padding:.5em 0;
-webkit-border-radius:.3em;
-moz-border-radius: .3em;
border:#1263be solid 1px;
background:#1b85fd;
color:#FFF;
font-size:17px;
font-weight:bolder;
letter-spacing:1em;
}

.login_btn input:hover{
background:#1263be;
}
shh816
推荐于2017-10-13 · TA获得超过724个赞
知道答主
回答量:521
采纳率:0%
帮助的人:94.1万
展开全部
是这样的效果吗?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>3</title>
<script>
function r()
{

var username=document.getElementById("username");

var pass=document.getElementById("password");
if(username.value=="")
{
alert("请输入用户名");
username.focus();
return;
}
if(pass.value=="")
{
alert("请输入密码");
return;
}
return true;
}
</script>
</head>
<body>
<form>
<table width="350" bgcolor="#ccffcc" style="border-color" border="1">
<tr align=center>
<td>用户名</td><td><input type="text" name="username" id="username"></td>
</tr>
<tr align=center><td>密 码</td><td><input type="password" name="password" id="password"></td></tr>
<tr align=center><td>验证码</td><td><input type="text" name="yanzheng"></td></tr>
<tr align=center><td colspan="2"><input type="button" value="登 录" onclick="r();"/>     <input type="reset" value="重 置"/></td></tr>

</table>
</form>
</body>
</html>
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
无是有否
2012-05-22 · TA获得超过164个赞
知道答主
回答量:25
采纳率:0%
帮助的人:15.8万
展开全部
大致形式应该是这样的:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>3</title>
</head>
<body>
<div align="center">
<form action="" name="myform">
<table>
<tr>
<td>用户名:</td>
<td><input type="text" id="user" /></td>
</tr>
<tr>
<td>密  码:</td>
<td><input type="text" id="password" /></td>
</tr>
<tr>
<td>验证码:</td>
<td align="left"><input type="text" size="5" id="code" /></td>
</tr>
</table>
</form>
<table>
<tr>
<td>
<input type="submit" value="提交" onclick=myfun_submit() />
</td>
<td>
<input type="submit" value="重置" onclick=myfun_reset() />
</td>
</tr>
</table>
</div>
<script type="text/javascript">
function myfun_submit(){

var user_val = document.getElementById("user").value;
var password_val = document.getElementById("password").value;
if(user_val==""){

alert("用户名不能为空!!");

}else if(password_val==""){

alert("密码不能为空!!!");

}

}
function myfun_reset(){
document.getElementById("user").value = "";
document.getElementById("password").value = "";
document.getElementById("code").value = "";

}
</script>
</body>
</html>
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
倾拉跳l
高粉答主

2020-04-24 · 每个回答都超有意思的
知道答主
回答量:7万
采纳率:1%
帮助的人:3757万
展开全部
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
tbb360
2012-05-22
知道答主
回答量:78
采纳率:0%
帮助的人:20万
展开全部
其实这个挺复杂的
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 2条折叠回答
收起 更多回答(4)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式