Bootstrap实现前端登录页面带验证码功能完整示例
作者:人间四月天 发布时间:2024-04-16 08:48:18
标签:Bootstrap,登录页面,验证码
本文实例讲述了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


猜你喜欢
- 字符串字符串常用操作拼接字符串拼接字符串需要使用‘+’运算符可完成对多个字符串的拼接。如str =
- time()方法返回时间,在UTC时代以秒表示浮点数。注意:尽管在时间总是返回作为一个浮点数,并不是所有的系统提供时间超过1秒精
- 前言URLconf 就像是 Django 所支撑网站的目录。它的本质是 URL 模式以及要为该 URL 模式调用的视图函数之间的映射表。你就
- 对url进行编码在服务器端我们可以使用asp中的server.urlencode,很方便实现。如:<% ss="asp之家欢
- 高阶函数是在Python中一个非常有用的功能函数,所谓高阶函数就是一个函数可以用来接收另一个函数作为参数,这样的函数叫做高阶函数。pytho
- 前言PHP5.3之后支持了类似Java的jar包,名为phar。用来将多个PHP文件打包为一个文件。首先需要修改php.ini配置将phar
- 本文实例讲述了Python redis操作。分享给大家供大家参考,具体如下:一、redisredis是一个key-value存储系统。和Me
- 简单的说:装饰器主要作用就是对函数进行一些修饰,它的出现是在引入类方法和静态方法的时候为了定义静态方法出现的。例如为了把foo()函数声明成
- 分别针对ie和火狐分别作了对xml文档和xml字符串的解析,所有代码都注释掉了,想看哪部分功能,去掉注释就可以了。至于在ajax环境下解析x
- 前言:这个系列的专栏是为了保持 Python 手感而创建的,也可以用来学习 Python,因为存在知识跨越难度,所以先学习滚雪球系列为佳。二
- 数据类型是所有开发语言的基础,JavaScript虽然是一个弱类型的脚本语言,但是在数据类型上也有很多讲究的,看了淘宝UED玉伯的一篇文章,
- 0、项目介绍本篇将会以HandTrackingModule为模块,这里的模块与之前的有所不同,请按照本篇为准,前面的HandTracking
- 概述Base64 是网络上最常见的用于传输 8Bit 字节码的编码方式之一,Base64 就是一种基于 64 个可打印字符来表示二进制数据的
- 上下文管理器是一种 Python 构造,它提供了一个类似 try-finally 的环境,具有一致的接口和方便的语法,例如通过&ld
- 下面给大家分享Python爬虫后获取重定向url的两种方法,具体内容如下所示;方法(一)# 获得重定向url from urllib imp
- 一、fitz库是什么?Fitz库是一个Python图像处理库,主要用于打开、编辑和保存PDF、TIFF和JPEG格式的图像。它可以帮助用户读
- 这篇文章记录一个采样器都随机地从原始的数据集中抽样数据。抽样数据采用permutation。 生成任意一个下标重排,从而利用下标来提取dat
- 我们继续学习Python异步编程,这里将介绍异步Web框架sanic,为什么不是tornado?从框架的易用性来说,Flask要远远比tor
- PHP count() 函数实例计算 car 节点的子节点个数:<?php $xml=<<<XML<cars&
- 本文实例讲述了Python打开文件、文件读写操作、with方式、文件常用函数。分享给大家供大家参考,具体如下:打开文件:在python3中,