私はjavascriptでいくつかのコードを書いていましたが、ほとんどのブラウザで動作する必要がありますが、googleChrome、IE、およびFFでのみ動作し、この関数を呼び出さないでください:
<script type="text/javascript">
showLocation(<?php print "\"$citta2\""?>,<?php print "\"$row[nome] $row[cognome]\""?>,<?php print "\"$row[id]\""?>); return false;
</script>
(最初に行うべきことはアラートを作成することであるため、それを呼び出さないことは知っています)それがクロムでのみ機能する理由を知っていますか?すべてのファイルが必要な場合は、以下に投稿できますが、少し長いです。問題はその呼び出しにあると確信しています。
edit1: ここに showLocation コードがあります:
function showLocation(address2,nomi0,id0) {
alert("1");
var nomi1 = nomi0;
var id1 = id0;
geocoder.getLocations(address1, function (response) {
if (!response || response.Status.code != 200)
{
alert("Errore con il primo indirizzo");
}
else
{
location1 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address};
geocoder.getLocations(address2, function (response)
{
if (!response || response.Status.code != 200)
{
alert("Errore con il secondo indirizzo");
}
else
{
location2 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address};
calculateDistance(nomi1,id1);
}
});
}
});
}
(Google Maps API を使用して、都市の緯度と経度を取得します)