谷歌地图 - 点击时标记不显示

时间:2022-06-29 21:14:22

I am trying to use the Google Map API- I've successfully managed to add an icon but when it is clicked nothing else happens...

我正在尝试使用Google Map API-我已经成功设法添加了一个图标但是当它被点击时没有其他事情发生......

This is my code:

这是我的代码:

function placeMarkerAtPoint(point)
{
    var marker = new GMarker(point,{icon: icon});

    GEvent.addListener(marker,"click",function() {

        marker.openInfoWindowHtml('here is some text');
    });

    map.addOverlay(marker);
}

When I run this in IE & click an Icon I see the not very useful javascript error: 'x' is null or not an object. I haven't even defined any variable called x ???

当我在IE中运行它并单击一个图标时,我看到不是非常有用的javascript错误:'x'为null或不是对象。我甚至没有定义任何名为x ???的变量

Thanks in advance for your your help

在此先感谢您的帮助

1 个解决方案

#1


Looks like you aren't instantiating an icon object (or not passing it into your placeMarkerAtPoint function).

看起来你没有实例化一个图标对象(或者没有将它传递给你的placeMarkerAtPoint函数)。

#1


Looks like you aren't instantiating an icon object (or not passing it into your placeMarkerAtPoint function).

看起来你没有实例化一个图标对象(或者没有将它传递给你的placeMarkerAtPoint函数)。