我在 joomla 2.5 中工作,我必须为Google map创建一个模块并使用Google map api v2。
我正在使用 geocoder = new GClientGeocoder();
,但它现在正在工作
输出图像:-
我的html<div>
标签
<div id="map_canvas" style="width: 800px; height:800px;"></div>
我的剧本
<script>
//<![CDATA[
var map = null;
var geocoder = null;
function initialize() {
if (GBrowserIsCompatible()) {
//calls map to appear inside <div> with id, "map_canvas"
map = new GMap2(document.getElementById("map_canvas"));
//adds zoom and arrow controls to map
geocoder = new GClientGeocoder();
map.setMapType(G_SATELLITE_MAP);
var allAddress = "Dubai~Abu Dhabi";
var addresses = new Array();
addresses = allAddress.split("~");
var curIndex = 0;
function showAddress() {
var _cur = addresses[curIndex];
geocoder.getLatLng(
_cur,
function(point) {
alert(_cur);
if (!point) {
alert(_cur + " not found");
} else {
alert(_cur+":"+point);
}
//do next after done
curIndex++;
if(curIndex<addresses.length)
showAddress();
}
);
}
showAddress();
}
}
//]]>
</script>