Images and Hyperlinks in InfoWindows from Attribute

620
1
05-09-2012 11:04 AM
ChrisDickerson
New Contributor
Hey I'm having some issues in trying to figure out what I need to do to be able to get images and hyperlinks to show up in the following code block.  I want to be able to populate the attribute table of the feature class with the all the paths for the images and with the hyperlinks information and pull that info so it shows in the infowindow.
Please help and thanks.

    function showFeature(feature,evt)
       {
         map.graphics.clear();
           //set symbol for highlighting
              var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.5]));
              feature.setSymbol(symbol);
              var attr = feature.attributes;
              var title = attr.NAME;
              var content = "Address : " + attr.Address
                    + "<br />Abbreviation : " + attr.Abbreviati
                    + "<br />Building Number : " + attr.BUILD_NUM
     + "<br />" + attr.Hyperlink
     + "<br />" + attr.Image_;
              //construct infowindow title and content
              map.graphics.add(feature);
              map.infoWindow.setTitle(title);
              map.infoWindow.setContent(content);
              (evt) ? map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint)) : null;
            }
0 Kudos
1 Reply
RanjeetShetye
New Contributor
First store the javascript variable

graphic.attributes = [];
graphic.attributes['NAME'] = "Some Name";


and then use
${NAME}
in your content HTML

You can use
<img src="${IMAGE_PATH}" height="xx4" width="yy"/>
in the HTML to refer to any images

Basically, for the infoWindow text, think in terms of HTML, and not javascript.
0 Kudos