がgmapsのAPI V3を実証するために、私はちょうどあなたhereのための小さな例を設置しました。これはあなたの記事であなたが言及した例に基づいてちょうど袖口のコードです。座標を入力してマーカをマップに追加し、特定のマーカを選択して情報ウィンドウを表示するだけです。
コードの主要部分は
マップの
作成
function initialize(){
var myOptions = {
zoom: 14,
center: new google.maps.LatLng(52.0, 62.0),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
infowindow = new google.maps.InfoWindow(
{
size: new google.maps.Size(150,50)
});
google.maps.event.addListener(map, 'click', function() {
infowindow.close();
});
markersArray = [];
}
マーカー
function createMarker(latlng, html,zoom) {
var contentString = html;
var marker = new google.maps.Marker({
position: latlng,
map: map,
zIndex: Math.round(latlng.lat()*-100000)<<5
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(contentString);
infowindow.open(map,marker);
});
marker.MyZoom = zoom;
return marker;
}
GOOGLを作成しますeマップapi v3ははるかに優れており、他のサンプルもチェックできますhere。
これはうまくいきましたか? – Philar