ロケーション配列の文字列に設定された値へのロード時にマップを中央に配置する必要があります。これを実行しようとすると、ブラウザーの html ファイルの名前が "London,New%20York" に変更されます。それ以外の場合、Google Maps API は機能します。
ここでいくつかのファンダがありませんか?
<script type="text/javascript">
var geocoder = new google.maps.Geocoder();
var map;
var location = ["London", "New York"];
var pos;
function initialize()
{
google.maps.visualRefresh = true;
getGeoCode();
var mapOptions = {
zoom: 8,
center: pos,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
}
function getGeoCode()
{
geocoder.geocode({'address': location[1]}, function(results, status){
if(status == google.maps.GeocoderStatus.OK)
{
pos = results[0].geometry.location;
}
else
{
alert("Not found");
}
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>