.net确实是要json php解释方式不同
jquery mobile两个页面以及源码(登录与注册)
Mr_kimilo 发表于 2011-10-12 17:06 1年前, 8回/5890阅, 最后回答: 2个月前 开源中国 5 周年,史上最牛定制开源马克杯!
先上图:
登录:
注册:
登录核心代码:
view sourceprint?01
02 jQuery(document).ready(function() {
03 //输入事件
04 $("input[id]").bind("focus",function () {
05 if($(this).attr("id")=='username'||$(this).attr("id")=='password')
06 $(this).attr("value","");
07 });
08 //提交
09 $("#submit").bind("click", function() {
10 if (valid()) {
11 $.ajax({
12 type: "POST",
13 url: "http://localhost:8080/note/servlet/Login",
14 data: $("form#loginform").serialize(),
15 success: function(msg){
16 if(msg=='success'){
17 $.mobile.changePage("content/first.html","slidedown", true, true);
18 }else{
19 $.mobile.changePage("content/loginfalse.html","slidedown", true, true);
20 }
21
22 }
23 });
24 }
25 });
26 });
27 //输入信息验证
28 function valid(){
29 if($("#username").attr("value")==''||$("#password").attr("value")=='')
30 {
31 $.mobile.changePage("content/loginfalse.html","slidedown", true, true);
32 return false;
33 }
34 return true;
35 };
36
37
38
39 p {
40 font-size: 1.5em;
41 font-weight: bold;
42 }
43 #submit{
44 float:right; margin:10px;
45 }
46 #toregist{
47 float:left; margin:10px;
48 }
49
50
51
52
53
54
开始笔记之旅
55
68
©2011 TinyNote 微笔记社区(movingcomputing.com)
69
70
71
72
73
74
注册核心代码:
view sourceprint?01
02 jQuery(document).ready(function() {
03 //输入事件
04 $("input[id]").bind("focus",function () {
05 if($(this).attr("value")=='用户名'||$(this).attr("value")=='密码')
06 $(this).attr("value","");
07 });
08 //提交
09 $("#regist").bind("click", function() {
10 if (true) {
11 $.ajax({
12 type: "POST",
13 url: "http://localhost:8080/note/servlet/Login",
14 data: $("form#loginform").serialize(),
15 success: function(msg){
16 if(msg=='success'){
17 $.mobile.changePage("../content/first.html","slidedown", true, true);
18 }else{
19 $.mobile.changePage("../content/loginfalse.html","slidedown", true, true);
20 }
21
22 }
23 });
24 }
25 });
26 });
27
28
29
30 p {
31 font-size: 1.5em;
32 font-weight: bold;
33 }
34 header div{
35 font-size: 1.5em;
36 }
37 #regist{
38 width:150px;
39 height:50px;
40 margin :5px;
41 }
42
43
44
45
46
47
48
49
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
http://www.oschina.net/question/101738_29271