2012-05-08 19 views
0

当最初的地图,我创建了功能如何获得是通过ID弹出在的OpenLayers地图

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和显示它,请帮我

回答

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