顯示ip地理位置信息


<!DOCTYPE html>
02 <html>
03     <head>
04  
05     <script type="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">
06 </script>
07 <meta http-equiv="content-type" content="text/html; charset=gb2312">
08     </head>
09     <body>
10     <center style="padding:400px 0">
11 ip:<input type="text" id="ip"/>
12 <input type="button" id="idbutton" value="�ύ"/>
13 </center>
14     </body>
15     <script type="text/javascript">
16 $(document).ready(function(){
17     $("#idbutton").click(getAddress);
18 });
19 function getAddress(obj) {
20     var ip=$("#ip").val();
21     $.ajax(
22             {
23                 url : 'http://whois.pconline.com.cn/ipJson.jsp',
24                 dataType : "script",
25                 data:{
26                     callback:'alertaddress',
27                     ip:ip
28                 },
29                 success : function() {
30                 }
31             });
32 }
33 function alertaddress(json)
34 {
35     alert(json.addr);
36 }
37 </script>
38 </html>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章