<html><body>Robertico,<br><br>I do not want the attributes to pop up as you click on the feature. I want to render the label and in another situation I want to style polygons with OpenLayers.Rule based on an attribute.<br><br>Reinaldo<br><hr><br>Reinaldo Escada Chohfi<br>Sócio Gerente<br>GeoDesign Internacional<br><a href="http://www.geodesign.com.br">www.geodesign.com.br</a><br>Tel./Fax: (12) 3153-5115<br> <br>Inteligência e Tecnologia Espacial de Ponta<br> <br><br><blockquote style="border-left: solid 2px #000000; margin-left: 5px; padding-left: 5px">---- Original Message ----<br><b>From</b>: robertico <robert_rdk@hotmail.com><br><b>To</b>: openlayers-users@lists.osgeo.org<br><b>Sent</b>: Sex, Nov 9, 2012, 13:45 PM<br><b>Subject</b>: Re: [OpenLayers-Users] Can Not Extract Attributes in KML File<br><br>Is there a function for a popup ?<br><pre>// Interaction; not needed for initial display.selectControl = new OpenLayers.Control.SelectFeature(layer);map.addControl(selectControl);selectControl.activate();layer.events.on({'featureselected': onFeatureSelect,'featureunselected': onFeatureUnselect});// Needed only for interaction, not for the display.function onPopupClose(evt) {// 'this' is the popup.var feature = this.feature;if (feature.layer) { // The feature is not destroyedselectControl.unselect(feature);} else { // After "moveend" or "refresh" events on POIs layer all  //     features have been destroyed by the Strategy.BBOXthis.destroy();}}function onFeatureSelect(evt) {feature = evt.feature;popup = new OpenLayers.Popup.FramedCloud("featurePopup", feature.geometry.getBounds().getCenterLonLat(), new OpenLayers.Size(100,100), //"<h4>"+feature.attributes.title + "</h4>" + feature.attributes.description, createPopupForm(),//replacement for previous line and works better for kml file null, true, onPopupClose);feature.popup = popup;popup.feature = feature;map.addPopup(popup, true);}// cutom poup formfunction createPopupForm() { var theHTML = ''; var layerVector   = map.layers[1]; var selectedFeature = layerVector.selectedFeatures[0]; var attributeName  = selectedFeature.attributes['name'] ? selectedFeature.attributes['name'] : "no name available"; theHTML += '<table style="background-color:#FFFFFF">'; theHTML += '<tr><td align="center" colspan="2"><span style="font-size:14px;font-weight:bold;background-color:#FFFFFF">' + attributeName + '</span><hr></td></tr>' ; for(var key in selectedFeature.attributes) {   if(key != "name" && key != "time" && key != "styleUrl") //theHTML += '<tr><td>' + key + ' :</td><td>' + selectedFeature.attributes[key] + '</td></tr>'; theHTML += '<tr><td><center>' + selectedFeature.attributes[key] + '</td></tr>'; } theHTML += '</table>'; return theHTML; } function onFeatureUnselect(evt) {feature = evt.feature;if (feature.popup) {popup.feature = null;map.removePopup(feature.popup);feature.popup.destroy();feature.popup = null;}}</pre><br><hr align="left" width="300">View this message in context: <a onclick="return checkLinkHref(this.href);" target="_blank" href="http://osgeo-org.1560.n6.nabble.com/Can-Not-Extract-Attributes-in-KML-File-tp5015176p5015198.html">Re: Can Not Extract Attributes in KML File</a><br>Sent from the <a onclick="return checkLinkHref(this.href);" target="_blank" href="http://osgeo-org.1560.n6.nabble.com/OpenLayers-Users-f3910695.html">OpenLayers Users mailing list archive</a> at Nabble.com.<br></blockquote></body></html>