首页 前端知识 用html和css写登陆页面并且跳转网站

用html和css写登陆页面并且跳转网站

2024-01-29 14:01:38 前端知识 前端哥 752 446 我要收藏
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="login.css">
</head>
<body>
<form action="2.学生信息管理.html" method="post">
<div id="login">
<span >
<h1 id="lo">学生信息管理系统</h1>
</span>
<div id="use">账号
<input text="text" id="user" required placeholder="请输入用户名" >
</div>
<br>
<div id="psw">密码
<input text="password" id="password" required placeholder="请输入密码" >
</div>
<br>
<br>
<button type="submit" onclick="myFunction()" id="butt">登录</button>
</div>
</form>
</body>
<script>
<!-- 登陆验证-->
function myFunction() {
if (document.getElementById("user").value == "a") {
if (document.getElementById("password").value == "1") {
alert("登录成功");
}
else {
alert("密码错误");
}
}
else {
alert("账号密码都错");
}
}
</script>
</body>
</html>
复制

2.cs

body{
/*初始化 */
margin: 1;
padding: 0;
}
#login{
border:1px solid rgb(18, 205, 205);
width: 500px;
height: 389px;
/* 固定定位,浏览器怎么滑动,这个块都不变 */
position: fixed;
right: 80px;
top: 150px;
/* background-color: #68a3c6;
background-image: linear-gradient(160deg, #68a3c6 0%, #80D0C7 100%);
*/
}
#lo{
width:500px;
text-align:center;
font-size: 50px;
}
#use,#psw{
width:70px;
text-align:center;
font-size: 25px;
}
#user,#password{
width:300px;
text-align:center;
font-size: 25px;
}
#butt{
width:500px;
height: 60px;
text-align:center;
font-size: 20px;
}
复制

转载请注明出处或者链接地址:https://www.qianduange.cn//article/758.html
标签
评论
发布的文章

HTML5 css3课后习题【一】

2024-02-10 19:02:20

css3 table表格

2024-02-10 19:02:01

CSS 基础知识 选择器

2024-02-10 19:02:50

float,flex和grid布局

2024-02-10 19:02:41

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!