dojo.connect(featureLayer, 'onClick', function(e) { /*some of the values have a quote in the name - remove that then split the string to separate the common and scientific names. */ var attr = e.graphic.attributes.qSpecies.replace('"', "").split("::"); //if the common name isn't included display the scientific name instead. var commonName = dojo.string.trim((attr[1] === "") ? attr[0] : attr[1]); //wikipedia uses the genus_species so build that value to append to wikipedia url var scientificName = dojo.string.substitute("${0}_${1}", attr[0].split(" ")); //populate the info window map.infoWindow.setTitle(e.graphic.attributes.qAddress); map.infoWindow.setContent("<b>" + commonName + "</b><br /><a target='_blank' href=http://en.wikipedia.org/wiki/" + scientificName + ">Wikipedia Entry</a>"); map.infoWindow.show(e.screenPoint, map.getInfoWindowAnchor(e.screenPoint)); });
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.