0
住所から経度と緯度を取得するために、これまで働いていた秘密のスクリプトがあります。 問題は提出できません。提出ボタンは経度と緯度を取得するために使用されます。Googleマップapi v2住所問題の経度と緯度
私は次のようにしたいと考えています: アドレスは隠しフィールドに配置されます。 (私のCMS、ExpressionEngineによって埋められています) ページ上に経緯度を入力し、緯度を2つの入力フィールド に集めてsubmitを押して完了します。
これを行うには、これまでのところ次のコードを使用します。 助けてください。
<!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>
<title>Longitude and Latitude from address</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=YOUR KEY" type="text/javascript" charset="utf-8">
</script>
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
geocoder = new GClientGeocoder();
}
}
function showAddress(geolocation) {
if (geocoder) {
geocoder.getLatLng(
geolocation,
function(point) {
if (!point) {
alert(geolocation + " not found");
} else {
document.geoform.longitude.value = point.x;
document.geoform.latitude.value = point.y;
}
}
);
}
}
//]]>
</script>
</head>
<body onload="load()">
<form action="#" name="geoform" id="geoform" onsubmit="showAddress(this.geolocation.value); return false">
<input type="hidden" name="geolocation" value="Address goes here, populated by cms" size="50" />
Decimal Longitude:
<input name="longitude" type="text" id="longitude" value="" />
Decimal Latitude:
<input name="latitude" type="text" id="latitude" value="" />
<input type="submit" value="Longitude/latitude codes" />
</form>
</body>
</html>
どのようなエラーが表示されていますか? – Unknown
Hello Matrix、私はエラーを取得していません。もし私が上記のスクリプトを使用すると、私はlongとlatを得るでしょう。フォームから「返品偽」を取り除くと、それは提出しているものの、長くて奇妙なものは得られません。だから、私はページの読み込みに使用したいです。 (私は試してみたが、運がない) –