[OpenLayers-Users] Popup Error: Select is not defined
Xavier Mamano (jorix)
xavier.mamano at gmail.com
Tue Apr 9 13:42:34 PDT 2013
Try:
function onPopupClose(event) {
control_select.unselectAll();
}
regards,
I am having a problem with my select control. I am not able to close the
popup box by clicking the red "x". When I try and click the red "x" I get
an error in the javascript console stating, "Uncaught ReferenceError: select
is not defined, Line 533".
Line 533:
function onPopupClose(event) {
select.unselectAll();
}
Other relevant code snippets:
mh_layer.events.on({
"featureselected": onFeatureSelect,
"featureunselected": onFeatureUnselect
});
var control_select = new OpenLayers.Control.SelectFeature(
[mh_layer, sp_layer], {
displayClass: 'olControlSelect'
}
);
function onFeatureSelect(event) {
var feature = event.feature;
// Since KML is user-generated, do naive protection against
// Javascript.
var content = "Manhole ID:" + feature.attributes.STRUCT_ID;
if (content.search("<script") != -1) {
content = "Content contained Javascript! Escaped
content below.<br>" + content.replace(/</g, "<");
}
popup = new OpenLayers.Popup.FramedCloud("chicken",
feature.geometry.getBounds().getCenterLonLat(),
new OpenLayers.Size(100,100),
content,
null, true, onPopupClose);
feature.popup = popup;
map.addPopup(popup);
}
</quote>
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Popup-Error-Select-is-not-defined-tp5045606p5045631.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list