Jquery-UI後台管理(1)

來源:互聯網
上載者:User

標籤:

登陸介面

先下載jquery-2.1.4 和EasyUI1.4.4

引用相關檔案到前台頁面中

html如下:

 1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <head runat="server"> 3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 4 <title>登陸</title> 5 <script src="../jquery-2.1.4/jquery.min.js"></script> 6 <script src="../EasyUI1.4.4/jquery.easyui.min.js"></script> 7 <link href="../EasyUI1.4.4/themes/default/easyui.css" rel="stylesheet" /> 8 <link href="../EasyUI1.4.4/themes/icon.css" rel="stylesheet" /> 9 <script src="JavaScript.js"></script>10 <link href="login.css" rel="stylesheet" />11 </head>12 <body>13 <form id="form1" runat="server">14 <div id="login">15 <p>管理員帳號:<input type="text" id="manager" class="textbox" /></p>16 <p>管理員密碼:<input type="text" id="password" class="textbox"/></p>17 </div>18 <div id="btn">19 <a href="#" class="easyui-linkbutton">登入</a>20 21 </div>22 </form>23 </body>24 </html>

js檔案內容如下:

 1 $(function () {                 //登陸介面 2     $("#login").dialog({ 3         title:‘登陸後台‘, 4         width:300, 5         height:180, 6         modal: true, 7         buttons:"#btn", 8     }); 9     10     //輸入框驗證11     $("#manager").validatebox({12         required: true,                           //是否驗證13         missingMessage: ‘請輸入管理員帳號!‘,       //為空白時顯示內容14         invalidMessage:‘管理員帳號不可為空!‘,15     });16     $("#password").validatebox({17         required: true,18         validType:‘length[6,30]‘,                  //驗證規則19         missingMessage: ‘請輸入管理員密碼!‘,20         invalidMessage: ‘管理員密碼必須在6-30位之間!‘,   //當文字框的內容被驗證為無效時出現的提示。21 22     });23 24     //點擊登陸25     $("#btn a").click(26         function () {27             if(!$("#manager").validatebox(‘isValid‘))  {    //判斷是否通過驗證28                 $("#manager").focus();29             }30             else if (!$("#password").validatebox(‘isValid‘)){    //判斷是否通過驗證         31                 $("#password").focus();32             }33             else {34                 alert("提交中...");35             }36         }37         );38     if (!$("#manager").validatebox(‘isValid‘)) {    //判斷是否通過驗證39         $("#manager").focus();40     }41     else if (!$("#password").validatebox(‘isValid‘)) {    //判斷是否通過驗證         42         $("#password").focus();43     }44 });

 

css樣式表內容如下:

body {}#login {    padding:6px 0 0 0;}p {    height:22px;    line-height:22px;    padding:4px 0 0 25px;}.textbox {    height:22px;    padding:0 2px;}.easyui-linkbutton {    padding:0 10px;}#btn {    text-align:center;}

 

這樣一個簡單的登陸介面就完成了。

可以用這個為模板,進行下一步的與資料庫的互動資料驗證的開發。

 

Jquery-UI後台管理(1)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.