您的位置:首页 > 编程语言 > Go语言

如何调用google地图的一个简单示例

2011-10-23 18:17 537 查看
首先至http://code.google.com/intl/zh-CN/apis/maps/signup.html注册得到使用地图的key

页面上使用代码:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=true_or_false&key=你的Key" type="text/javascript"></script>
<script type="text/javascript">
function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(39.9493, 116.3975), 13);
}
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">

<form id="form1" runat="server">
<div id="map_canvas" style="width: 500px; height: 300px"></div>
</form>
</body>
</html>

示例效果:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐