用高德api开放的AMap.event.addListener()给地图里的指定marker添加一个click效果打开一个iframe的网址没有反应,请问如何解决,谢谢!
var icon = new AMap.Icon({
size: new AMap.Size(50, 50),
image: '.png',
imageSize: new AMap.Size(50, 50)
});
var marker = new AMap.Marker({
position: new AMap.LngLat(116.405467, 39.907761),
offset: new AMap.Pixel(-10, -10),
icon: icon,
title: '无人机',
clickable: true,
zoom: 13
});
AMap.event.addListener(marker, 'click', function () {
var iframe = document.createElement('iframe');
iframe.id = "myFrameId";
iframe.src = 'url';
document.getElementById("container").appendChild(iframe);
alert(123);
});
map.add(marker);