[b]【一】需求如下:[/b]
1:注册不新开页面,改成弹出层,
2:新增用户买房欲望调查,
3:用户名自动检索出推荐的用户名,
4:出生日期用户输入改成控件选择。
5:尽力提高用户体验,吸引用户注册。
[b]【二】无图无真相。[/b]
1:简化后的页面:
[img]http://files.jb51.net/file_images/article/201006/1.gif[/img]
2:浮出文字提示和圆角边框:
[img]http://files.jb51.net/file_images/article/201006/2.gif[/img]
[img]http://files.jb51.net/file_images/article/201006/3.gif[/img]
3:支持民意调查(异步提交)
[img]http://files.jb51.net/file_images/article/201006/44.gif[/img]
4:自动检索推荐用户名(测试数据)
[img]http://files.jb51.net/file_images/article/201006/5.gif[/img]
5:数据有效性验证
[img]http://files.jb51.net/file_images/article/201006/6.gif[/img]
6:日历
[img]http://files.jb51.net/file_images/article/201006/8.gif[/img]
[img]http://files.jb51.net/file_images/article/201006/9.gif[/img]
7:支持拖拽
[img]http://files.jb51.net/file_images/article/201006/10.gif[/img]
8:滑入显示
[img]http://files.jb51.net/file_images/article/201006/11.gif[/img]
9:over
[img]http://files.jb51.net/file_images/article/201006/12.gif[/img]
【三】代码分析
1.弹出层的制作,
a.先引用这三个:
[url=examples.css]
b.调用这个方法$.prompt,实现弹出。
2.浮出文字
a.先引用这两个:
<link rel="stylesheet" media="all" type="text/css" href="jquery.tooltip.css" />
<script src="jquery.tooltip.min.js" type="text/javascript" language="javascript"></script>
b.调用下面代码实现浮出:
代码
[url=rater.css]
b.调用$('#demo2').rater('Handler1.ashx')实现投票
4.自动检索推荐用户名(自动完成)
a.先引用下面两个
<script src="jquery.autocomplete.min.js" type="text/javascript" language="javascript"></script>
<link rel="stylesheet" media="all" type="text/css" href="jquery.autocomplete.css" />
<script src="localdata.js" type="text/javascript" language="javascript"></script>
b.调用 $("#suggest2").focus().autocomplete(cities);实现自动检索,(用的是localdata.js里面的本地测试数据)
5.数据校验
a.先引用这 <script src="jquery.validate.js" type="text/javascript" language="javascript"></script>
再写如下CSS:
[url=rightbar.css]
b.再写如下代码
var c = new Calendar("c");
document.write(c);
//下面两个用为微调定位
c.offsetTop =22;
c.offsetLeft = 25;
html代码:
[url=http://xiazai.jb51.net/201006/yuanma/jquery_aspnet.rar]代码打包下载[/url]
作者:张磊(zhanglei's Blog)