DIV CSS 佈局教程網

jQuery + CSS 網站登錄模板:帳密登入與掃碼登入切換
編輯:JQuery特效代碼     

這是一個完整的登入頁模板,含驗證碼欄位,並提供「登錄管理」與「掃碼直達」兩個頁籤切換。

在線體驗:https://hovertree.com/texiao/jquery/13.htm

Demo2、Demo3、Demo4 可從原文頁進入。

頁面結構

整體採 .pagewrap > .main > .header + .content 的兩欄式配置:左側 .con_left 放視覺素材,右側 .con_right 是操作區。右側上方 .con_r_top 有兩個頁籤連結,用下方邊框顏色(border-bottom-color)區分目前選取狀態,這是不必切換圖片就能做出頁籤效果的輕量做法。

下方 ul 內含兩個 li: QR code 面板(con_r_left)與表單面板(con_r_right),透過 display:none 與 display:block 的切換呈現不同內容。

表單欄位

<div class="user">
 <div>
 <span class="user-icon"></span>
 <input type="text" id="userid" name="userid" placeholder=" 輸入賬號" value="">
 </div>
 <div>
 <span class="mima-icon"></span>
 <input type="password" id="pwd" name="pwd" placeholder=" 輸入密碼" value="">
 </div>
 <div>
 <span class="yzmz-icon"></span>
 <input id="vdcode" type="text" name="validate" placeholder=" 驗證碼" value="" style=" width:150px;">
 <img style="cursor: pointer; margin-top:8px;" id="imgHoverTreeCode"
 alt="看不清?點擊更換" title="看不清?點擊更換"
 src="https://hovertree.com/texiao/jquery/13/hovertreecheckcode.gif">
 </div>
</div>

每個欄位前都用 span 搭配背景圖做出小圖示;驗證碼圖片加上 cursor:pointer 與提示文字,告知使用者可以點擊更換(實際換圖邏輯需搭配後端產生新的驗證碼)。表單的 autocomplete="off" 可關閉瀏覽器的自動填入。

完整程式碼

<!DOCTYPE html>
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <title>網站登錄模板 - 何問起</title>
 <link type="text/css" rel="stylesheet" href="https://hovertree.com/texiao/jquery/13/login.css">
 <script type="text/javascript" src="https://hovertree.com/ziyuan/jquery/jquery-1.11.3.min.js"></script>
 <script type="text/javascript" src="https://hovertree.com/texiao/jquery/13/login.js"></script>
</head>
<body style="overflow:hidden">
 <div class="pagewrap">
 <div class="main">
 <div class="header"></div>
 <div class="content">
 <div class="con_left"></div>
 <div class="con_right">
 <div class="con_r_top">
 <a href="javascript:;" class="left">掃碼直達</a>
 <a href="javascript:;" class="right">登錄管理</a>
 </div>
 <ul>
 <li class="con_r_left" style="display: none;">
 <div class="erweima">
 <div class="qrcode">
 <div id="output" style="width: 100%; position: relative">
 <img src="https://hovertree.com/texiao/jquery/13/2weima.png" style="width: 174px; height: 174px">
 </div>
 </div>
 </div>
 <div style="height: 70px"><p>掃碼上網 安全便捷</p></div>
 </li>
 <li class="con_r_right" style="display: block;">
 <form name="form1" method="post" action="https://tool.hovertree.com/info/ip/" autocomplete="off">
 <div class="user">
 <div><span class="user-icon"></span><input type="text" id="userid" name="userid" placeholder=" 輸入賬號" value=""></div>
 <div><span class="mima-icon"></span><input type="password" id="pwd" name="pwd" placeholder=" 輸入密碼" value=""></div>
 <div>
 <span class="yzmz-icon"></span>
 <input id="vdcode" type="text" name="validate" placeholder=" 驗證碼" value="" style=" width:150px;">
 <img id="imgHoverTreeCode" alt="看不清?點擊更換" title="看不清?點擊更換" src="https://hovertree.com/texiao/jquery/13/hovertreecheckcode.gif">
 </div>
 </div>
 <button id="btn_Login" type="submit">登 錄</button>
 </form>
 </li>
 </ul>
 </div>
 </div>
 </div>
 </div>
</body>
</html>

使用時記得把驗證碼圖片的路徑換成自己網站的產生端點,並依後端欄位名稱調整 name 屬性。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved