I have the following code in my file, which I got from the sundials example.
Nevertheless, clicking the red 'X' of a popup doesn't close it (however,
clicking the background of the map or clicking another popup-producing feature
will close the popup). What could possibly explain this?
function onPopupClose(evt) {
select.unselectAll();
}
function onFeatureSelect(event) {
var feature = event.feature;
// Since KML is user-generated, do naive protection against Javascript.
var content = "<h2>"+feature.attributes.name + "</h2>" +
feature.attributes.description;
if (content.search("<script") != -1) {
content = "Content contained Javascript! Escaped content
below.<br>" + content.replace(/</g, "<");
}
popup = new OpenLayers.Popup.FramedCloud("popup",
feature.geometry.getBounds().getCenterLonLat(),
new OpenLayers.Size(100,100),
content,
null, true, onPopupClose);
feature.popup = popup;
map.addPopup(popup);
}
function onFeatureUnselect(event) {
var feature = event.feature;
if(feature.popup) {
map.removePopup(feature.popup);
feature.popup.destroy();
delete feature.popup;
}
}
________________________________________________________________________________
Keith Wiley [email protected] keithwiley.com music.keithwiley.com
"I used to be with it, but then they changed what it was. Now, what I'm with
isn't it, and what's it seems weird and scary to me."
-- Abe (Grandpa) Simpson
________________________________________________________________________________
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users