<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>[米随随] s5s5 - Google Map API 小型应用</title>
<link rel="shortcut icon" href="http://www.misuisui.com/favicon.ico" />
</head>
<body>
<div id="map" style="width: 600px; height: 400px; border: 1px solid #979797"></div>
<!-- 把以上代码为地图的宽和高,可修改里面的数值,不要改里面的ID -->
<script src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAAlwlonOoTX0oPrDaRmH_ALBREKWcFDKg74ezPgAUa79EBKj9z1BTjAKcZV51YfdN2n4xhiJ2lKuvBeA" type="text/javascript"></script>
<!-- 此为Google Map API 的验证码,用到自己的网站要去 http://www.google.com/apis/maps/ 审请一个 -->
<script type="text/javascript">
//<![CDATA[
function createMarker(point, baseIcon, html) {
var icon = new GIcon(baseIcon);
var marker = new GMarker(point, icon);
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
function loadMap(){
var map = new GMap(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.setMapType(G_HYBRID_TYPE);
map.centerAndZoom(new GPoint(116.429114, 39.934322), 0); //在这里116.429114, 39.934322代表地图的中心位置,后面的0是放到最大,数字越大,地图显示的越多
// 以下是定义一些基本信息
// 阴影,阴影偏移,信息框偏移, 什么什么的
var icon = new GIcon();
icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
icon.shadowSize = new GSize(21, 29);
icon.iconAnchor = new GPoint(10, 30);
icon.infoWindowAnchor = new GPoint(9, 5);
icon.infoShadowAnchor = new GPoint(9, 5);
//在地图上标一个图标,点击就出现字
var html = '<div style="text-align: left; width: 12em;"><img src="http://www.misuisui.com/images/21_29_s5s5.png" /><s>你这个淫真是的,摸人家干啥啊?</s></div>'; //这里是显示在信息框里的东东,支持HTML
icon.image = "http://www.misuisui.com/images/21_29_s5s5.png"; //定义图标,一定要PNG格式的
icon.iconSize = new GSize(21, 29); //图标的宽和高
var point = new GPoint(116.429114, 39.934322); //图标标在地图的哪里
var marker = createMarker(point, icon ,html);
map.addOverlay(marker);
//标一个图标完毕
//在地图上再标一个图标,点击就出现字,改的方法如上
html = '<div style="text-align: left; width: 12em;"><img src="http://www.misuisui.com/images/21_29_s5s5.png" /><i>淫僧法号米随随~</i></div>';
icon.image = "http://www.misuisui.com/images/21_29_s5s5.png";
icon.iconSize = new GSize(21, 29);
point = new GPoint(116.429424, 39.934322);
marker = createMarker(point, icon ,html);
map.addOverlay(marker);
//标一个图标完毕,这段代码复制多少个,就有多少个图标,只要改改里面的东东就可以了
//在地图上再标一个图标,点击就出现字,改的方法如上
html = '<div style="text-align: left; width: 12em;"><img src="http://www.misuisui.com/images/21_29_s5s5.png" />点击<a href="http://www.misuisui.com/weblog/article.asp?id=398" target="_top">这里</a>看看米随随是怎么整出来的~</div>';
icon.image = "http://www.misuisui.com/images/21_29_s5s5.png";
icon.iconSize = new GSize(21, 29);
point = new GPoint(116.429314, 39.934522);
marker = createMarker(point, icon ,html);
map.addOverlay(marker);
//标一个图标完毕,这段代码复制多少个,就有多少个图标,只要改改里面的东东就可以了
//在地图上再标一个图标,点击就出现字,改的方法如上
html = '<div style="text-align: left; width: 12em;"><img src="http://www.misuisui.com/images/21_29_s5s5.png" /><font color="blue">阿弥陀佛~淫僧米随随哪!~</font></div>';
icon.image = "http://www.misuisui.com/images/21_29_s5s5.png";
icon.iconSize = new GSize(21, 29);
point = new GPoint(116.429714, 39.934522);
marker = createMarker(point, icon ,html);
map.addOverlay(marker);
//标一个图标完毕,这段代码复制多少个,就有多少个图标,只要改改里面的东东就可以了
//最后一个图标将一开始显示下面的内容
defaultmsg = '<div style="text-align: left; width: 12em;"><img src="http://www.misuisui.com/images/21_29_s5s5.png" /><font color="red">点击淫僧米随随哪!~</font></div>'; //这里是显示在信息框里的东东,支持HTML
marker.openInfoWindowHtml(defaultmsg);
}
loadMap();
//]]>
</script>
</body>
</html>