Google Maps API3 之 Hello World
2016-03-27 19:39
501 查看
<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>
<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>
相关文章推荐
- 搭建golang环境
- LeetCode Algorithms #107 <Binary Tree Level Order Traversal II>
- LeetCode OJ 之Merge TwoSorted Lists 解题报告
- LeetCode OJ 之 GenerateParenthesis解题报告
- 教程: Windows 7、Vista 开启ipv6支持
- 英文歌曲:my heart will go on(我心永恒)
- 文本分类与聚类(text categorization and clustering)
- Golang给目录按时间排序.正则、时间条件搜索文件
- google hosts(2)
- google hosts(2)
- google hosts(2)
- 对于 AlphaGo 和 人类之间 PK 的一个设想实验
- Go语言学习(八)获取命令行参数
- HDOJ Let's go to play
- google ===最新hosts文件(亲测)
- go语言(二):基本知识
- go语言关于零值的定义
- go语言捕获panic异常并转化为error
- google在线測试练习题1
- buptoj:Study sister's dragon