Google Map 代码

演示: http://www.ivucc.com/blog/googlemap.htm
我 网站 付有Google Maps API 详细说明 这里不能贴html 编下去太麻烦了

 1<html xmlns="http://www.w3.org/1999/xhtml">
 2<head>
 3<script src="http://maps.google.com/maps?file=api&amp;v=1&amp;key=  ABQIAAAAldeplnSa046Mgs42FWv1vxSzB1HpiWZ7bOrz1NckBd6pSmH0tBQ-3-pJ2Wlqv7eA95U9YxBebInG2g  " type="text/javascript"></script>
 4</head>
 5<body>
 6<div id="map" style="width: 500px; height: 400px"></div> /#地图大小   
 7<script type="text/javascript">   
 8//<![CDATA[   
 9  
10var map = new GMap(document.getElementById("map"));   
11map.addControl(new GSmallMapControl());   
12map.centerAndZoom(new GPoint(-122.1419, 37.4419), 4);   
13  
14//]]>   
15</script> </body>
16</html>

ABQIAAAAldeplnSa046Mgs42FWv1vxSzB1HpiWZ7bOrz1NckBd6pSmH0tBQ-3-pJ2Wlqv7eA95U9YxBebInG2g " 这个是我网站的key
key要去http://www.google.com/apis/maps/signup.html申请!
登陆用GMAIL就可以了

1<script type="text/javascript">   
2//<![CDATA[   
3  
4var map = new GMap(document.getElementById("map"));   
5map.addControl(new GSmallMapControl());   
6map.centerAndZoom(new GPoint(-122.1419, 37.4419), 4);   
7  
8//]]>   
9</script>

这个可以该坐标~
我的看你做参考

CODE:[Copy to clipboard]
 1<script type="text/javascript">   
 2//<![CDATA[   
 3function onLoad() {   
 4// Center the map on Beijing   
 5var map = new GMap(document.getElementById("map"));   
 6map.addControl(new GSmallMapControl());   
 7map.addControl(new GMapTypeControl());   
 8map.centerAndZoom(new GPoint(116.416, 39.916), 13);   
 9  
10var BeijingStation = new GMarker (new GPoint (116.416,39.916));   
11GEvent.addListener (BeijingStation, "click", function() {   
12BeijingStation.openInfoWindowHtml ("北京-中国的首都");   
13});   
14map.addOverlay (BeijingStation);   
15  
16map.openInfoWindow(map.getCenterLatLng(),   
17document.createTextNode("MSN space~!googlemap插件"));   
18  
19  
20// Center the map on Smilingfish   
21var SmilingfishStation = new GMarker (new GPoint (117.35,24.516));   
22GEvent.addListener (SmilingfishStation, "click", function() {   
23SmilingfishStation.openInfoWindowHtml ("[福建]福建地区 googlemap<br>广告出租");   
24});   
25map.addOverlay (SmilingfishStation);   
26  
27  
28// Center the map on Liuyue   
29var LiuyueStation = new GMarker (new GPoint (104.066,30.66));   
30GEvent.addListener (LiuyueStation, "click", function() {   
31LiuyueStation.openInfoWindowHtml ("[四川重庆]鱼是不是在这个地方?");   
32});   
33map.addOverlay (LiuyueStation);   
34// Center the map on Huoxian   
35var HuoxianStation = new GMarker (new GPoint (113,28.2166));   
36GEvent.addListener (HuoxianStation, "click", function() {   
37HuoxianStation.openInfoWindowHtml ("[湖南长沙]<br />超级女生~");   
38});   
39map.addOverlay (HuoxianStation);   
40  
41// Center the map on Wuyi   
42var WuyiStation = new GMarker (new GPoint (116.4,39.9));   
43GEvent.addListener (WuyiStation, "click", function() {   
44WuyiStation.openInfoWindowHtml ("[北京海淀]<br /> 刘亦菲 你在吗?");   
45});   
46map.addOverlay (WuyiStation);   
47  
48// Center the map on Wuyi2   
49var Wuyi2Station = new GMarker (new GPoint (108.3,22.8));   
50GEvent.addListener (Wuyi2Station, "click", function() {   
51Wuyi2Station.openInfoWindowHtml ("[广西南宁]<br />美女很多~~~");   
52});   
53map.addOverlay (Wuyi2Station);   
54  
55//绘制线条   
56var points = [new GPoint (116.416,39.916), new GPoint (112.533,37.866), new GPoint (117.35,24.516), new GPoint (113,28.2166),new GPoint (104.066,30.66),new GPoint (108.3,22.8)];   
57var line = new GPolyline(points, "#ff0000");   
58map.addOverlay(line);   
59  
60}   
61//]]>   
62</script>

Published At
Categories with Web编程
Tagged with
comments powered by Disqus