0

When initial the map, I created many popup for features

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

but I can not get a exist popup when I location a point ,I want get it by it's id and show it, please help me

4

1 回答 1

0

这个想法应该是:当用户点击你识别的某个点时,应该显示弹出窗口,不是吗?

你可以这样做:

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;
      }
   }
});
于 2012-05-12T12:06:27.013 回答