地图标记在本地显示,但不在现场显示

时间:2013-01-20 21:57:00

标签: javascript google-maps

我已经和Google Maps打了几天,现在我得到了这个奇怪的“虫子” 我有一个听众,每当我按下地图时,都会出现一个蓝色标记......

但是,只有当我从硬盘运行HTML文件时才会发生这种情况。一旦我通过我的服务器运行它,就不会出现蓝色标记。我不知道为什么。

执行此操作的代码部分如下所示:

//the listener that activates the function if I click on the map
google.maps.event.addListener(map, 'click', function(event) 
{
    setAddress(event.latLng);
});  

//a global marker - because I want a different one if I press another time on the screen  
var marker2= new google.maps.Marker(
{
    map:map,
    title:"title",
    icon:'blue_markerA.png'
});  

//set the marker to the exact location...  
function setAddress(location) 
{
    var point = new google.maps.LatLng(
    parseFloat(location.lat()),parseFloat(location.lng()));

    marker2.setPosition(point);
}

0 个答案:

没有答案