谷歌地图标记链接失败

Google maps Marker link failure

本文关键字:链接 失败 图标 地图 谷歌      更新时间:2023-09-26

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

 // 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);
});

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