首页 > Windows开发 > 详细

Google Maps API3 之 Hello World

时间:2016-03-27 21:10:27      阅读:308      评论:0      收藏:0      [点我收藏+]

<html xmlns="http://www.w3.org/1999/xhtml">

????<head>

????????<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

????????<title>My first map</title>

?

????????<style type="text/css">

????????????<!-- #map {

????????????????width: 100%;

????????????????height: 500px;

????????????????border: 1px solid #000;

????????????}

????????????-->

????????</style>

?

????????<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

????????<script>

????????????window.onload = function() {

????????????????// Creating a reference to the mapDiv

????????????????var mapDiv = document.getElementById(‘map‘);

????????????????// Creating a latLng for the center of the map

????????????????var latlng = new google.maps.LatLng(39.92, 116.46);

????????????????// Creating an object literal containing the properties

????????????????// we want to pass to the map

????????????????var options = {

????????????????????center: latlng,

????????????????????zoom: 10,

????????????????????mapTypeId: google.maps.MapTypeId.ROADMAP

????????????????};

????????????????// Creating the map

????????????????var map = new google.maps.Map(mapDiv, options);

????????????}

????????</script>

????</head>

?

????<body>

????????<h1>My first map</h1>

????????<div id="map"></div>

????</body>

?

</html>

?

技术分享

Google Maps API3 之 Hello World

原文:http://www.cnblogs.com/my4piano/p/5326562.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!