js 핸드폰 번호 귀속 지 및 유효 여부 판단

2673 단어 js핸드폰 번호

//       
	function searchMobileArea(){
	     var phone=$.trim($("#key_S").val());
	     if(searchAreaMobilePhoneFromIndex(phone)){//     
	         searchMobilePhoneGuiSuArea(phone);//       
	     }
	}
	
	//     
	function searchAreaMobilePhoneFromIndex(mobileNo){
	    if (mobileNo == "") {  alert("       "); return (false);  } 
        if (mobileNo.length != 11) { alert("   11    "); return (false); }
		if (isNaN(mobileNo)){ alert("   11   "); return (false); }
        return true;
	}
	
	//        
	function searchMobilePhoneGuiSuArea(mobileNo){
		 var $searchPhonearea = $("#searchPhoneArea");
	     $searchPhonearea.html("<div class='loadingdiv' style='width:150px;'><div class='loadingArea'>   ,   ...</div></div>");
		 $.ajax({
	  		 type:"POST",
	  		 url:"https://service.sh.10086.cn/tools.do?method=getPhoneNativeInfo",
	  		 datatype:"text",
	  		 data:"phone="+mobileNo,
	  		 success:function(res){
	  		 	  var mobilehtml = "";
	  		      if(res!="-1" && res!="-2"){
					   mobilehtml += '<div>    :<span class="fontHigh">'+mobileNo+'</span></div>';   
			           var result=res.split(";");
			           if(result[1]==result[3]){
					  	  mobilehtml += '<div>    :<span class="fontHigh">'+result[1]+'</span></div>';   
			           } else {
					  	  mobilehtml += '<div>    :<span class="fontHigh">'+result[1]+' '+result[3]+'</span></div>';
			           }
			           mobilehtml += '<div>   :<span class="fontHigh">0'+result[2]+'</span></div>';
			           $searchPhonearea.html( mobilehtml );
			           $("#key_S").val(""); 
		          } else { $searchPhonearea.html("<span class='fontHigh'>    !           ...</span>");	  }
	         },
	         error:function(xml){ $searchPhonearea.html("<span class='fontHigh'>    !           ...</span>");	 }
	     });
	}
	
	function searchMobileAreaBykeyDown(event,obj){
		var event=event||window.event;
		if(event.keyCode == 13){  searchMobileArea();  }
	}


좋은 웹페이지 즐겨찾기