js登录界面带提示
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <title>$.ajax()方法發(fā)送請求</title>
5 <script type="text/javascript"
6 src="Jscript/jquery-1.4.2-vsdoc.js">
7 </script>
8 <script type="text/javascript"
9 src="Jscript/jquery-1.4.2.js">
10 </script>
11 <style type="text/css">
12 body{font-size:13px}
13 .divFrame{width:225px;border:solid 1px #666}
14 .divFrame .divTitle{padding:5px;background-color:#eee;height:23px}
15 .divFrame .divTitle span{float:left;padding:2px;padding-top:5px;}
16 .divFrame .divContent{padding:8px;text-align:center}
17 .divFrame .divContent .clsShow{font-size:14px;line-height:2.0em}
18 .divFrame .divContent .clsShow .clsError{font-size:13px;border:solid 1px #cc3300;padding:2px;display:none;margin-bottom:5px;background-color:#ffe0a3}
19 .txt{border:#666 1px solid;padding:2px;width:150px;margin-right:3px}
20 .btn {border:#666 1px solid;padding:2px;width:50px;
21 filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff, EndColorStr=#ECE9D8);}
22 </style>
23 <script type="text/javascript">
24 $(function() {
25 $.ajax({ //請求登錄頁
26 url: "login.html", //登錄靜態(tài)頁
27 dataType: "html",
28 success: function(HTML) { //返回頁面內(nèi)容
29 $("#frmUserLogin").html(HTML); //將頁面內(nèi)容置入表單
30 $("#btnLogin").click(function() { //“登錄”按鈕單擊事件
31 //獲取用戶名稱
32 var strTxtName = encodeURI($("#txtName").val());
33 //獲取輸入密碼
34 var strTxtPass = encodeURI($("#txtPass").val());
35 //開始發(fā)送數(shù)據(jù)
36 $.ajax({ //請求登錄處理頁
37 url: "login.aspx", //登錄處理頁
38 dataType: "html",
39 //傳送請求數(shù)據(jù)
40 data: { txtName: strTxtName, txtPass: strTxtPass },
41 success: function(strValue) { //登錄成功后返回的數(shù)據(jù)
42 //根據(jù)返回值進(jìn)行狀態(tài)顯示
43 if (strValue == "True") {
44 $(".clsShow").html("操作提示,登錄成功!");
45 }
46 else {
47 $("#divError").show().html("用戶名或密碼錯誤!");
48 }
49 }
50 })
51 })
52 }
53 })
54 })
55 </script>
56 </head>
57 <body>
58 <form id="frmUserLogin"></form>
59 </body>
60 </html> View Code
login.htm
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/wuchao288/p/Tree.html
總結(jié)
- 上一篇: Android-TCPDump for
- 下一篇: 我的四年建站故事(X)