<转>Google Map 显示当前IP所在位置

奇怪,我这机器运行不了这程序

http://www.iteye.com/topic/740640

Html代码 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<HTML> 
<HEAD> 
  <TITLE> New Document </TITLE> 
  <meta http-equiv="content-type" content="text/html; charset=utf-8"/> 
  <script type="text/javascript" src="http://fw.qq.com/ipaddress" charset="GBK"></script> 
  <script type="text/javascript" src="http://www.google.com/jsapi?key=abc"></script> 
  <script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key=abc"></script> 
  <script type="text/javascript"> 
    function loadMaps(address) {  
      var map = new google.maps.Map2(document.getElementById("map"));  
      map.addControl(new GSmallMapControl());  
      map.addControl(new GMapTypeControl());  
      var geocoder = new GClientGeocoder();  
      geocoder.getLatLng(  
        address,  
        function(point) {  
          if (!point) {  
            alert(address + " not found");  
            map.setCenter(new GLatLng(35.8616600, 104.1953970), 4);  
          } else {  
            map.setCenter(point, 12);  
            var marker = new GMarker(point);  
            map.addOverlay(marker);  
            marker.openInfoWindowHtml(address);  
          }  
        }  
      );  
    }  
 
    function init() {  
      loadMaps(IPData[2]);  
    }  
    </script>   
</HEAD> 
 
<BODY onload="init()" onunload="GUnload()"> 
  <div id="map" style="width: 800px; height: 600px"></div>   
</BODY> 
</HTML> 

猜你喜欢

转载自jennycn.iteye.com/blog/1222478
今日推荐