一百行代码实现的HTML5登录页面

今天开始写博客了,正在进行学校的h5实训,将实训作业发到博客上来记录一下。
在这里插入图片描述

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			* {
				margin: 0px;
			}

			#content {
				margin: 150px auto;
				width: 100%;
				height: 460px;
				border: 1px transparent solid;
				background-color: #21D4FD;
				background-image: linear-gradient(243deg, #21D4FD 0%, #B721FF 100%);
				background-image: -webkit-linear-gradient(243deg, #21D4FD 0%, #B721FF 100%);
				background-image: -moz-linear-gradient(243deg, #21D4FD 0%, #B721FF 100%);
				background-image: -o-linear-gradient(243deg, #21D4FD 0%, #B721FF 100%);
			}

			#box {
				margin: 50px auto;
				width: 30%;
				height: 360px;
				background-color: #fff;
				text-align: center;
				border-radius: 15px;
				border: 2px #fff solid;
				box-shadow: 10px 10px 5px #000000;
			}

			.title {
				line-height: 58px;
				margin-top: 20px;
				font-size: 36px;
				color: #000;
				height: 58px;
			}

			#box:hover {
				border: 2px #fff solid;
			}

			.input {
				margin-top: 20px;
			}

			input {
				margin-top: 5px;
				outline-style: none;
				border: 1px solid #ccc;
				border-radius: 3px;
				padding: 13px 14px;
				width: 70%;
				font-size: 14px;
				font-weight: 700;
				font-family: "Microsoft soft";
			}

			button {
				margin-top: 20px;
				border: none;
				color: #000;
				padding: 15px 32px;
				text-align: center;
				text-decoration: none;
				display: inline-block;
				font-size: 16px;
				border-radius: 15px;
				background-color: #CCCCCC;
			}
			button:hover{
				background-color: #B721FF;
				color: #fff;
			}
		</style>
	</head>
	<body>
		<div id="content">
			<div id="box">
				<div class="title">Login</div>
				<div class="input">
					<input type="text" id="username" value="" placeholder="用户名" />
					<br>
					<input type="password" id="password" placeholder="密码" />
					<br>
					<input type="password" id="password1" placeholder="再次输入" />
					<br>
					<button type="button" onclick="getuser()">登录</button>
				</div>
			</div>
		</div>

	</body>
	<script type="text/javascript">
		function getuser() {
			var username = document.getElementById("username").value;
			var password = document.getElementById("password").value;
			var password1 = document.getElementById("password1").value;
			testing(username, password,password1)
			//alert("username:"+username+"\n"+"password:"+password);
		}

		function testing(username, password, password1) {
			var tmp = username && password;
			if (tmp == "") {
				alert("请填写完整信息");
				return 0;
			}
			if (username.length < 6 || username.length > 16) {
				alert("用户名长度为:6-16位")
				return 0;
			} 
			if (password<6 || password1<6)
			{
				alert("密码长度错误");
			}else if(password == password1){
				alert("username:" + username + "\n" + "password:" + password);
			}else{
				alert("两次输入的密码不一样");
			}
		}
	</script>
</html>

  • 19
    点赞
  • 81
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
好的,下面是一个简单的示例代码实现页面滑动效果和鼠标滑动登陆页面: ``` <!DOCTYPE html> <html> <head> <title>滑动效果和登陆页面</title> <style> body { margin: 0; padding: 0; overflow: hidden; } #wrapper { height: 100vh; width: 100vw; display: flex; flex-direction: column; overflow-y: scroll; } #login { height: 100vh; width: 100vw; background-color: #ccc; display: flex; align-items: center; justify-content: center; font-size: 36px; color: #fff; } </style> </head> <body> <div id="wrapper"> <div id="login"> <p>登陆页面</p> </div> <div> <p>其他页面内容</p> <p>其他页面内容</p> <p>其他页面内容</p> <p>其他页面内容</p> <p>其他页面内容</p> <p>其他页面内容</p> <p>其他页面内容</p> <p>其他页面内容</p> <p>其他页面内容</p> <p>其他页面内容</p> </div> </div> <script> document.getElementById("wrapper").addEventListener("wheel", function(event) { if (event.deltaY > 0) { this.scrollBy(0, window.innerHeight); } else { this.scrollBy(0, -window.innerHeight); } }); </script> </body> </html> ``` 这个代码中的 `#wrapper` 元素设置了 `overflow-y: scroll` 属性,使得它可以垂直滚动。我们监听了 `wheel` 事件来捕捉滚轮滚动事件,然后根据滚轮滚动方向,使用 `scrollBy` 方法来让 `#wrapper` 元素滚动一个屏幕的高度。 在代码中我们设置了一个 `#login` 元素,作为登陆页面的内容。你可以将它替换成你需要的登陆页面的 HTML 代码

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值