Bootstrap實現(xiàn)前端登錄頁面帶驗證碼功能完整示例
本文實例講述了Bootstrap實現(xiàn)前端登錄頁面帶驗證碼功能。分享給大家供大家參考,具體如下:
Bootstrap有自定義的驗證碼樣式,在前端頁面可以直接使用,他的css、js在使用前要在開頭引入
上代碼:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <!-- 告訴瀏覽器網(wǎng)頁所識別的文件類型及語言類型 --> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>登錄</title> <!-- 讓一些搜索引擎搜索到你的網(wǎng)頁 --> <meta name="description" content=""> <meta name="keywords" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" 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>圖書閱讀網(wǎng)</h1> <p>一個免費的圖書網(wǎng)站</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測試上述代碼運行效果。
PS:關(guān)于bootstrap布局,這里再為大家推薦一款本站的在線可視化布局工具供大家參考使用:
在線bootstrap可視化布局編輯工具:
http://tools.jb51.net/aideddesign/layoutit
希望本文所述對大家基于bootstrap的程序設(shè)計有所幫助。
- Bootstrap實現(xiàn)登錄校驗表單(帶驗證碼)
- 使用BootStrap實現(xiàn)用戶登錄界面UI
- jfinal與bootstrap的登錄跳轉(zhuǎn)實戰(zhàn)演習(xí)
- php bootstrap實現(xiàn)簡單登錄
- 分享Bootstrap簡單表格、表單、登錄頁面
- Bootstrap彈出帶合法性檢查的登錄框?qū)嵗a【推薦】
- bootstrap flask登錄頁面編寫實例
- PHP實現(xiàn)登錄注冊之BootStrap表單功能
- 基于Bootstrap實現(xiàn)下拉菜單項和表單導(dǎo)航條(兩個菜單項,一個下拉菜單和登錄表單導(dǎo)航條)
- Bootstrap中文本框的寬度變窄并且加入一副驗證碼圖片的實現(xiàn)方法
相關(guān)文章
使用defer和async實現(xiàn)高效加載JavaScript
async和defer都是異步加載腳本,但async是加載完腳本后立即執(zhí)行,而defer是在HTML解析完成后再執(zhí)行腳本,本文給大家介紹了如何使用defer和async高效加載JavaScript,文中通過代碼和圖文講解的非常詳細(xì),需要的朋友可以參考下2024-06-06用javascrpt將指定網(wǎng)頁保存為Excel的代碼
這段代碼在服務(wù)器中沒有權(quán)限,可以保存在本地,存為htm文件,運行即可,就可以把文本內(nèi)容存為excel文件了2008-01-01判斷數(shù)組是否包含某個元素的js函數(shù)實現(xiàn)方法
下面小編就為大家?guī)硪黄袛鄶?shù)組是否包含某個元素的js函數(shù)實現(xiàn)方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-05-05javascript模擬php函數(shù)in_array
就是判斷一個元素是否存在于數(shù)組中的函數(shù),既然js里string都有indexOf函數(shù),為什么不在Array對象里設(shè)置一個這樣的函數(shù)呢,其實就用indexOf這個思想挺好的,不知道制定JS標(biāo)準(zhǔn)的人是基于什么考慮,把這樣一個如此常用的功能沒考慮在內(nèi)的。2015-04-04