您当前的位置:天天ASP学习网页制作JavaScript → 文章内容

google地图API翻墙问题解决

作者:本站  来源:本站整理  发布时间:2018-07-24 15:36:31
<script src="http://ditu.google.cn/maps/api/js?key=AIzaSyBOqL-UJbuYe5BCXf3lLxsfIIDAEhaD8bQ&sensor=false&language=zh-CN"></script>
    <script>
       var myCenter1=new google.maps.LatLng(51.508742,-0.120850);
       var myCenter2=new google.maps.LatLng(51.508742,-0.130850);
       var myCenter3=new google.maps.LatLng(51.508742,-0.140850);

            function initialize()
            {
                var mapProp1 = {
                    center:myCenter1,
                    zoom:16,
                    mapTypeId:google.maps.MapTypeId.ROADMAP
                };
                var mapProp2 = {
                    center:myCenter2,
                    zoom:16,
                    mapTypeId:google.maps.MapTypeId.ROADMAP
                };
                var mapProp3 = {
                    center:myCenter3,
                    zoom:16,
                    mapTypeId:google.maps.MapTypeId.ROADMAP
                };
                var map1=new google.maps.Map(document.getElementById("googleMap1"),mapProp1);
                var map2=new google.maps.Map(document.getElementById("googleMap2"),mapProp2);
                var map3=new google.maps.Map(document.getElementById("googleMap3"),mapProp3);

                var marker1=new google.maps.Marker({
                    position:myCenter1,
                });
                var marker2=new google.maps.Marker({
                    position:myCenter2,
                });
                var marker3=new google.maps.Marker({
                    position:myCenter3,
                });
                marker1.setMap(map1);
                marker2.setMap(map2);
                marker3.setMap(map3);
            }

            google.maps.event.addDomListener(window, 'load', initialize);
    </script>
完美解决google不能翻墙的问题。
文章评论 (评论内容只代表网友观点,与本站立场无关!)