首页 > 代码库 > jquery mobile两个页面以及源码(登录与注册) 转
jquery mobile两个页面以及源码(登录与注册) 转
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | < script type = "text/javascript" > jQuery(document).ready(function() { //输入事件 $("input[id]").bind("focus",function () { if($(this).attr("id")==‘username‘||$(this).attr("id")==‘password‘) $(this).attr("value",""); }); //提交 $("#submit").bind("click", function() { if (valid()) { $.ajax({ type: "POST", url: "http://localhost:8080/note/servlet/Login", data: $("form#loginform").serialize(), success: function(msg){ if(msg==‘success‘){ $.mobile.changePage("content/first.html","slidedown", true, true); }else{ $.mobile.changePage("content/loginfalse.html","slidedown", true, true); } } }); } }); }); //输入信息验证 function valid(){ if($("#username").attr("value")==‘‘||$("#password").attr("value")==‘‘) { $.mobile.changePage("content/loginfalse.html","slidedown", true, true); return false; } return true; }; </ script > < style type = "text/css" > p { font-size: 1.5em; font-weight: bold; } #submit{ float:right; margin:10px; } #toregist{ float:left; margin:10px; } </ style > < body > <!-- begin first page --> < section id = "page1" data-role = "page" > < header data-role = "header" data-theme = "b" >< h1 >开始笔记之旅</ h1 ></ header > < div data-role = "content" class = "content" > < p style = "backg" >< font color = "#2EB1E8" >登录微笔记</ font ></ p > < form method = "post" id = "loginform" > < input type = "text" name = "username" id = "username" value = "用户名" />< br > < input type = "password" name = "password" id = "password" value = "密码输入提示" /> < fieldset data-role = "controlgroup" > < input type = "checkbox" name = "checkbox-1" id = "checkbox-1" class = "custom" /> < label for = "checkbox-1" >保持登录状态</ label > </ fieldset > < a href = "content/regist.html" data-role = "button" id = "toregist" data-theme = "e" >注册</ a > < a data-role = "button" id = "submit" data-theme = "b" >登录</ a > </ form > </ div > < footer data-role = "footer" >< h1 >©2011 TinyNote 微笔记社区(movingcomputing.com)</ h1 ></ footer > </ section > <!-- end first page --> </ body > |
注册核心代码:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | < script type = "text/javascript" > jQuery(document).ready(function() { //输入事件 $("input[id]").bind("focus",function () { if($(this).attr("value")==‘用户名‘||$(this).attr("value")==‘密码‘) $(this).attr("value",""); }); //提交 $("#regist").bind("click", function() { if (true) { $.ajax({ type: "POST", url: "http://localhost:8080/note/servlet/Login", data: $("form#loginform").serialize(), success: function(msg){ if(msg==‘success‘){ $.mobile.changePage("../content/first.html","slidedown", true, true); }else{ $.mobile.changePage("../content/loginfalse.html","slidedown", true, true); } } }); } }); }); </ script > < style type = "text/css" > p { font-size: 1.5em; font-weight: bold; } header div{ font-size: 1.5em; } #regist{ width:150px; height:50px; margin :5px; } </ style > < body > <!-- begin first page --> < section data-role = "page" > < header data-role = "header" data-theme = "b" data-type = "horizontal" > < div data-role = "controlgroup" > < nav data-role = "navbar" > < ul > < li >< a href = "#page1" class = "ui-btn-active" >注册微笔记</ a ></ li > < li >< a href = "#page2" >用手机号注册</ a ></ li > </ ul > </ nav > </ div > </ header > < div data-role = "content" class = "content" > < form method = "post" id = "registform" > < label for = "email" >邮 箱</ label > < input type = "text" name = "email" id = "email" /> < label for = "password" >密 码</ label > < input type = "password" name = "password" id = "password" /> < label for = "nicky" >昵 称</ label > < input type = "text" name = "nicky" id = "nicky" /> < fieldset data-role = "controlgroup" > < legend >身 份:</ legend > < input type = "radio" name = "radio-choice-1" id = "radio-choice-1" value = "choice-1" checked = "checked" /> < label for = "radio-choice-1" >上班族</ label > < input type = "radio" name = "radio-choice-1" id = "radio-choice-2" value = "choice-2" /> < label for = "radio-choice-2" >大学生</ label > < input type = "radio" name = "radio-choice-1" id = "radio-choice-3" value = "choice-3" /> < label for = "radio-choice-3" >其他</ label > </ fieldset > < center > < a data-role = "button" id = "regist" data-theme = "e" >立即注册</ a > </ center > </ form > </ div > </ section > <!-- end first page --> </ body > 登录核心代码:
?
注册核心代码:
?
|
jquery mobile两个页面以及源码(登录与注册) 转
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。