Select to view content in your preferred language

How to set hyperlink in a Popup window/InfoTemplate

2400
2
Jump to solution
01-13-2014 01:04 PM
LeiZhou
Deactivated User
I need to set up an InfoTemplate as the following:
var plantId = new InofTemplate("My Popup Window", "${*}" ); plantId = setContent(getTextContent);  function getTextContent(graphic) {           var htext = graphic.attributes.plantWeb_URL;                 return "<a target='_blank' href="{htext}">Click the Hyper Link to See the Web</a>"; }


The variable plantWeb_URL is a esriFieldTypeString parameter from a feature layer I created, it is url string.  I need the hyperlink href to read the variable, so that when users click the text, it will direct the web according to the specific url from plantWeb_URL. 

But it seems herf has to be followed by a specific webpage, like when href = http:www.dsdfsfsfds.com.  Can I let it read from a variable representing different url address? Thanks!
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor
I used an existing sample and inserted this code

var url = "http://www.esri.com"; var template = new esri.InfoTemplate("", "${Postal Address} <br/> Owner of record: ${First Owner Name} <br/>"                                           + "<a target='_blank' href=" + url +">Esri home page</a>"); 

View solution in original post

0 Kudos
2 Replies
KenBuja
MVP Esteemed Contributor
I used an existing sample and inserted this code

var url = "http://www.esri.com"; var template = new esri.InfoTemplate("", "${Postal Address} <br/> Owner of record: ${First Owner Name} <br/>"                                           + "<a target='_blank' href=" + url +">Esri home page</a>"); 
0 Kudos
LeiZhou
Deactivated User
Thank you very much!

I used an existing sample and inserted this code

var url = "http://www.esri.com";
var template = new esri.InfoTemplate("", "${Postal Address} <br/> Owner of record: ${First Owner Name} <br/>"
                                          + "<a target='_blank' href=" + url +">Esri home page</a>");

0 Kudos