zoukankan      html  css  js  c++  java
  • google maps api 作者:围城

    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript">// <![CDATA[
    (function(googleMap){
    /*
        编写:围城(solq)
        bolg:http://cnblogs.com/solq
       demo : http://solq.sinaapp.com/googlemaps 日期:2011-11-27 ///////////////////////////////////////////////////////////////////////// 方法说明 init: 初始化 getMap: 获取map 资源 latLng: 设置地图坐标 click : 地图点击事件 zoom: 地图缩放事件 marKer : 在坐标加标识 如小图标,title infoWindow: 提示信息 tip close : 关闭 infoWindow ps: 如何查找 google 地图的坐标 搜索后,将目标设置为中心,然后在浏览器输入 javascript:void(prompt('',gApplication.getMap().getCenter()));
    */ var GoogleMaps={ 'init':function(dom,option) { var option=option || { zoom: 16, center: this.latLng(23.13356238514348, 113.3354651927948), mapTypeId: googleMap.MapTypeId.ROADMAP }; /* G_NORMAL_MAP- 默认视图 G_SATELLITE_MAP - 显示 Google 地球卫星图像 G_HYBRID_MAP - 混合显示普通视图和卫星视图 G_DEFAULT_MAP_TYPES - 这三个类型的数组,在需要重复处理的情况下非常有用 ROADMAP SATELLITE HYBRID TERRAIN */ this.map=new googleMap.Map(dom,option); return this; }, 'getMap':function() { return this.map; }, 'latLng':function(x,y) { return new googleMap.LatLng(x,y); }, 'click':function(fn,map) { googleMap.event.addListener(map || this.map,'click',fn); return this; }, 'zoom':function(fn,map) { googleMap.event.addListener(map || this.map,'zoom_changed',fn); return this; }, 'marKer':function(option) { return this.marker=new googleMap.Marker(option || { position:this.latLng(23.13356238514348, 113.3354651927948), map: this.map, title:"xxxxxxxxxxxxxxxxxxxxx" //icon: "images/dot/xxx" }); }, 'infoWindow':function(msg,map,marker) { var tip=new googleMap.InfoWindow({ content:msg }); tip.open( (map || this.map ), (marker || this.marker ) ); setTimeout(function(){tip.close();},5000); //5秒后自动关闭 return tip; }, 'close':function(infoWindow) { if(infoWindow) infoWindow.close(); return this; }, 'test':function() { var marKer=this.marKer(); $this=this; this.click(function(){ var content= '<div class="alerts"><span>哈哈</span><br/><img src=images/b.jpg width=340/><br/>地址:广州天河xxx<br/> qq: 360174425</div>' var t=$this.infoWindow(content,$this.map,marKer); //console.log(t); //console.log($this.map); },marKer); return this; }//还有好多api 侍续 }; window.GoogleMaps=GoogleMaps; })(google.maps); window.onload=function() { var dom=$$("map_canvas"); GoogleMaps .init(dom) .click(function(event){ //alert(event.latLng.lat());//纬度 //alert(event.latLng.lng());//经度 }) .test(); } function $$(o){return document.getElementById(o);} // ]]></script>
  • 相关阅读:
    配置FTP服务
    Tomcat
    LNMP环境配置(下)
    LNMP环境配置(上)
    Ansible---
    Ansible
    正则三剑客-------grep
    Docker仓库的使用与维护
    Docker 引擎的安装 -->>存储库安装
    shell脚本实例
  • 原文地址:https://www.cnblogs.com/solq/p/2473581.html
Copyright © 2011-2022 走看看