谷歌地图标记链接失败

时间:2016-07-21 11:52:29

标签: javascript google-maps google-maps-api-3

我的google标记链接拒绝运行。我点击它不会打开链接。

 // Let's also add a marker while we're at it

                var image = 'images/icons/mapicon.png';                 
                var beachMarker = new google.maps.Marker({
                    position: new google.maps.LatLng(39.419659, -77.4126419),                   
                    map: map,
                    icon: image,
                    url: 'https://www.google.com'
        });

                    google.maps.event.addListener(marker, 'click', function() {
                        window.open(marker.url);
});

1 个答案:

答案 0 :(得分:1)

您的addListener指向标记变量,但您的标记定义为 beachMarker