﻿
﻿
J1616.chaxun.youbian={title:"邮编区号",bindEvents:function(){$("#btnSubmit").click(function(){$("#auswer .answer").empty();var v=$.trim($("#txt").val());if(!v){$("#auswer .answer:eq(0)").html(J1616.chaxun.errorText("请输入地名或邮编"));return false;}
$("#auswer .answer:eq(0)").html("521yy.com正在为您查询……");v=v.substr(0,7);$.getScript("http://chaxun.1616.net/s.php?type=zip&v="+encodeURIComponent(v)+"&output=json&callback=J1616.chaxun.youbian.callback");});$("#txt").keyup(function(e){e=e||window.event;if(e.keyCode==13){$("#btnSubmit").click();}});$("#txt").recoverableInputText();},callback:function(j){switch(j.QueryResult){case 0:$("#auswer .answer:eq(0)").html(J1616.chaxun.errorText("请输入正确的地名或邮编"));break;case 1:this._fillData(j);break;case 2:$("#auswer .answer:eq(0)").html(J1616.chaxun.errorText("无法查询到相应信息，请输入其他邮编或者地名"));break;case 3:$("#auswer .answer:eq(0)").html(J1616.chaxun.errorText("内部错误，请重试"));break;case 4:$("#auswer .answer:eq(0)").html(J1616.chaxun.errorText("发生错误，请重试"));break;}},_fillData:function(j){$("#auswer .answer:eq(0)").html(j.Name);$("#auswer .answer:eq(1)").html(j.AreaCode);$("#auswer .answer:eq(2)").html(j.PostCode);},init:function(){this.bindEvents();J1616.chaxun.showTitle(this.title);}};J1616.chaxun.youbian.init();