<!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>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=[あなたのAPIキー]" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map;
var gGeo;
function makeMap(){
max=4;
for(i=1; i<=max; i++){
//マーカー作成
var address=document.getElementById("q"+i).value;
addMarker(address);
}
function addMarker(address){
gGeo.getLatLng(address,
function (point){
if (point) {
//マーカーを作成
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
var txt="<div align='left'><b>住所:</b>" + address + "<br/></div>";
marker.openInfoWindowHtml(txt);
});
//マーカーを地図上に配置
map.addOverlay(marker);
}
}
);
}
}
function refresh(){
map.clearOverlays();
makeMap();
}
window.onload = function(){
//初期化
map = new GMap2(document.getElementById("gmap"));
map.setCenter(new GLatLng(36, 138), 6);
map.addControl(new GLargeMapControl());
gGeo = new GClientGeocoder();
makeMap();
}
//]]>
</script>
</head>
<body onunload="GUnload()">
<div id="map" style="width: 500px; height: 500px"></div>
</body>
</html>