Bootstrap实现前端登录页面带验证码功能完整示例
作者:人间四月天 时间:2024-04-16 08:48:18
本文实例讲述了Bootstrap实现前端登录页面带验证码功能。分享给大家供大家参考,具体如下:
Bootstrap有自定义的验证码样式,在前端页面可以直接使用,他的css、js在使用前要在开头引入
上代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- 告诉浏览器网页所识别的文件类型及语言类型 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>登录</title>
<!-- 让一些搜索引擎搜索到你的网页 -->
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="external nofollow" >
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"></script>
<script src="tool.js"></script>
<style>
.carousel-inner img {
width:100%;
height:100%;
}
.jumbotron {
margin-top: 10px;
margin-bottom: 0px;
padding-top: 10px;
}
#demo {
width:100%;
height: 500px;
}
.row {
height: 264px;
}
.left {
float: left;
width: 70%;
}
.right {
float: left;
width: 30%;
}
.card {
height: 340px;
}
.carousel-inner {
height: 500px;
}
.footer {
position: absolute;
bottom: 0;
height: 60px;
}
.jumheight1 {
height: 100px;
}
.jumheight2 {
height: 100px;
}
.end_name {
margin-bottom: 5px;
}
.footer2 {
padding-top: 210px;
text-align: center;
}
.test{
margin-bottom: 75px;
}
.carousel-control-prev,
.carousel-control-next{
bottom: 120px;
}
</style>
</head>
<body>
<div>
<form class="form active" method="post" action="{:url('index/Login/doLogin')}">
<div class="jumbotron text-info bg-light jumheight1">
<h1>图书阅读网</h1>
<p>一个免费的图书网站</p>
</div>
<!-- 轮播图 -->
<!-- 指示符 -->
<div class="row">
<div class="left">
<div id="demo" class="carousel slide " data-ride="carousel">
<ul class="carousel-indicators">
<li data-target="#demo" data-slide-to="0" class="active"></li>
<li data-target="#demo" data-slide-to="1"></li>
<li data-target="#demo" data-slide-to="2"></li>
</ul>
<!-- 轮播图片 -->
<div class="carousel-inner">
<div class="carousel-item active">
<img src="http://static.runoob.com/images/mix/img_fjords_wide.jpg">
</div>
<div class="carousel-item">
<img src="http://static.runoob.com/images/mix/img_nature_wide.jpg">
</div>
<div class="carousel-item">
<img src="http://static.runoob.com/images/mix/img_mountains_wide.jpg">
</div>
</div>
<!-- 左右切换按钮 -->
<a href="#demo" rel="external nofollow" rel="external nofollow" class="carousel-control-prev" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a href="#demo" rel="external nofollow" rel="external nofollow" class="carousel-control-next" data-slide=next>
<span class="carousel-control-next-icon"></span>
</a>
</div>
</div>
<div class="right">
<!-- 登陆窗口 -->
<div class="card">
<div class="card-header">
用户登陆
</div>
<div class="card-body">
<form>
<table style="border-collapse: separate;/*border-spacing: 30px 20px;*/">
<tr>
<td class="margin-top:10">
<label>电话号码:</label>
</td>
<td>
<input type="text" name="username" pattern="^\d{11}" id="username" class="form-control" placeholder="请输入您的电话号码">
<!-- <input type="text" name="username" pattern="^\d{11}" id="username" class="form-control" placeholder="请输入您的电话号码" required> -->
</td>
</tr>
<tr>
<td>
<label>密码:</label>
</td>
<td>
<input type="password" name="password" id="password" class="form-control" placeholder="请输入您的密码">
</td>
</tr>
<tr>
<td>
<label for="captcha" class="test">验证码:</label>
</td>
<td>
<input type="text" name="captcha" class="form-control " id="captcha" placeholder="请输入验证码">
<!-- 点击验证码更换 -->
<br>
<div class="code-img"><img height="50px" src="{:captcha_src()}" alt="captcha" onClick="this.src='{:captcha_src()}?'+Math.random()"/></div>
</td>
</tr>
</table>
<div class="footer">
<button type="submit" class="btn btn-primary" >登陆</button>
<button type="submit" class="btn btn-secondary " formaction="{:url('index/Repassword/index')}" >忘记密码?</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
fieldTest();
</script>
</body>
</html>
效果图:
这里还有轮播图,点击验证码时会更新
可以使用在线HTML/CSS/JavaScript代码运行工具:http://tools.jb51.net/code/HtmlJsRun测试上述代码运行效果。
来源:https://blog.csdn.net/weixin_42580925/article/details/102691357
标签:Bootstrap,登录页面,验证码
0
投稿
猜你喜欢
python实现高斯投影正反算方式
2022-11-17 08:58:19
Python利用format函数实现对齐打印(左对齐、右对齐与居中对齐)
2021-07-30 05:16:16
python实现宿舍管理系统
2023-12-28 14:14:27
OpenCV半小时掌握基本操作之对象测量
2023-06-08 12:09:18
Python读写及备份oracle数据库操作示例
2024-01-21 17:09:45
goland -sync/atomic原子操作小结
2024-04-26 17:20:08
python实现任意位置文件分割的实例
2021-01-17 18:18:22
如何创建一个对索引服务器进行查询的ASP页面?
2009-11-14 20:54:00
详解Python中的from..import绝对导入语句
2022-08-10 10:01:33
Python中xml和dict格式转换的示例代码
2021-07-18 21:30:10
HTML5 移动页面自适应手机屏幕宽度详解
2022-08-14 23:14:43
Python图像处理之几何变换
2021-05-05 12:46:39
js使用Canvas将多张图片合并成一张的实现代码
2024-05-25 15:17:59
PHP格式化显示时间date()函数案例讲解
2023-06-13 06:45:34
实例简析XPath串函数和XSLT
2008-09-04 14:16:00
python ctypes库2_指定参数类型和返回类型详解
2021-10-17 14:34:50
pandas使用函数批量处理数据(map、apply、applymap)
2023-03-07 11:12:09
基于一致性hash算法(consistent hashing)的使用详解
2024-01-25 02:30:02
关于Python 实现tuple和list的转换问题
2022-02-18 21:29:03
pymongo为mongodb数据库添加索引的方法
2024-01-22 17:51:51