All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
详细讲解PHP编程中分页显示的制作_[PHP教程]
GridView,批量删除,自定义分页,定位页码_[Asp.Net教程]
用Apache与MySQL整合实现基本身份认证_php资料_编程技术
DataList中HyperLink数据绑定及链接写法_[Asp.Net教程]
项目调试时出现用到的一个组件“访问被拒绝”的解决方法_[Asp.Net教程]
关于ASP.NET,2.0的目录结构变化_[Asp.Net教程]
XSL教程:了解XSL的选择模式_[XML教程]
在ASP.NET中利用VWD操作数据库简介_[Asp.Net教程]
网页制作应掌握技术:随心所欲定制页面"弹出窗口"_JavaScript技术_编程技术
Delphi执行sql server模糊查询
Reading number is top 10 pictures
ashlynn brooke
每天进步一点点
BingBingFan apple dew point photo gallery5
Ashlynn Brooke photograph of a group2
Household design of gorgeous series
Female model behind the bitterness, often being overcharged4
Summer is most suitable for young people to travel in China7
Desktop Wallpapers1
I also want to live a June 1 children's day, dad
人美胸美腿更美4
Download software ranking
C#高级编程(第4版)
Be there or be square
Prostitutes diary
Unix video tutorial1
Take off clothes to survival
The Bermuda triangle1
XML+Web+Service开发教程
少妇苏霞全本
Jinling thirteen stock
VeryCD电驴(EasyMule) V1.1.9 Build09081
归海一刀 published in(发表于) 2014/3/16 2:52:02 Edit(编辑)
AJAX实例:根据邮编自动完成地址信息_[AJAX教程]

AJAX实例:根据邮编自动完成地址信息_[AJAX教程]

AJAX实例:根据邮编自动完成地址信息_[AJAX教程]























采用一个开源的AJAX库:Ajax Toybox


  描述:




  在注册或购物车结帐的时候,需要用户填入个人资料,这个环节可以简练一下,我们只需客人填入邮政编码,然后就根据这个邮政编码,自动从数据库中取出相应的省,市等地址信息。这样既可以减少客户的输入,增加客户体验,又可以减少由于资料输入而产生的错误。




  实现:




HTML

Enter A United States Zipcode, Then Tab










Enter Zipcode:















City:















State:















  以上是客户输入页面,下面是服务端的处理页面'zipcode.php




dbuser = 'root';
dbpass = '111111';

cn = mysql_connect("localhost", dbuser, dbpass);
db = mysql_select_db("ajax");

sql = "select city, state from zipcodes where zipcode = " . _REQUEST['zip'];
rs = mysql_query(sql);
row = mysql_fetch_array(rs);

echo row['city'] . "|" . row['state'];

mysql_close(cn);
?>




  当客户输入一个POSTCODE后,zipcode.php就接收到它,然后进行从数据表中取出对应的资料,再按一定的格式返回给客户端(此处是以 | 分隔)。最后客户端接收返回的资料,显示在页面上。




if(response.indexOf('|' != -1)) {
update = response.split('|');
document.getElementById("city").value = update[0];
document.getElementById("state").value = update[1];
}






作者:jxyuhua 来源:CSDN









































添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.