Google Maps基础及实例解析(2)

<html> <head> <script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false"> </script> <script> function initialize() { var mapProp = { center: new google.maps.LatLng(51.508742,-0.120850), zoom:9, mapTypeId: google.maps.MapTypeId.ROADMAP }; var mapProp2 = { center: new google.maps.LatLng(51.508742,-0.120850), zoom:9, mapTypeId: google.maps.MapTypeId.SATELLITE }; var mapProp3 = { center: new google.maps.LatLng(51.508742,-0.120850), zoom:9, mapTypeId: google.maps.MapTypeId.HYBRID }; var mapProp4 = { center: new google.maps.LatLng(51.508742,-0.120850), zoom:9, mapTypeId: google.maps.MapTypeId.TERRAIN }; var map = new google.maps.Map(document.getElementById("googleMap"),mapProp); var map2 = new google.maps.Map(document.getElementById("googleMap2"),mapProp2); var map3 = new google.maps.Map(document.getElementById("googleMap3"),mapProp3); var map4 = new google.maps.Map(document.getElementById("googleMap4"),mapProp4); } google.maps.event.addDomListener(window, 'load', initialize); </script> </head> <body> <div></div> <br> <div></div> <br> <div></div> <br> <div></div> </body> </html>

加载地图

窗口载入后通过执行 initialize() 函数来初始化 Map 对象,这样可以确保在页面完全载入后再加载 Google 地图:

google.maps.event.addDomListener(window, 'load', initialize);

以上就是对Google 地图基础资料的整理,后续继续补充,谢谢大家对本站的支持!

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzxgxz.html