在初始地图时,我为要素创建了许多弹出窗口
var popup= new OpenLayers.Popup.FramedCloud(
id, //id
new OpenLayers.LonLat(msg.reviseLng, msg.reviseLat),
new OpenLayers.Size(160,100),
'<html></html>',
null,
true);
popup.autoSize=false;
map.addPopup(popup);
但是当我定位一个点时,我无法获得存在的弹出窗口,我想通过它的ID获取它并显示它,请帮助我
这个想法应该是:当用户点击你识别的某个点时,应该显示弹出窗口,不是吗?
您可以通过以下方式执行此操作:
map.events.register("click", map , function(e){
// Look for point... (your code)
// Point detected!
// now we need to take the popup identified by 'popupid' identifier and show it
for(var i=0; i<map.popups.length; i++){
if(map.popups[i].id == myid){
map.popups[i].show();
break;
}
}
});