Hyperlinks in Tabbed Info Window

721
4
Jump to solution
05-04-2012 11:16 AM
EmilyLaMunyon
Occasional Contributor
Hello,

I am using the following example (http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jssamples_start.htm#jssa...)

for info windows with tabs. Everything seems to working fine except for the hyperlink. I need to create a url string that uses 3 attributes from the layer, and what I have so far is not working. I have tried so many variations with no luck. Does anyone have any insight as how to make this url string work?

content+="<td>"+" <a href="http://surveyor.slco.org/javamap/mrs_test.cfm?  + layerResults.features.attributes['POINT_NAME'] + layerResults.features.attributes['LATITUDE_DD']+ " target=_blank ;'>Mon. Ref Sheet</a></td>";

Thanks for any help, this is driving me crazy!!
0 Kudos
1 Solution

Accepted Solutions
danbecker
Occasional Contributor III
building html strings can be tricky; use of double vs single quote

this should work
content+="<td><a href='http://surveyor.slco.org/javamap/mrs_test.cfm?"+layerResults.features.attributes['POINT_NAME']+layerResults.features.attributes['LATITUDE_DD'] + " target='_blank'>Mon. Ref Sheet</a></td>"; 


In js, you can't have a string containing double quote "; the string has to contain single quote ' like this
var str = "<a href='myurl'>text</a>"; // <-- single quotes around href attribute, inside of " "

View solution in original post

0 Kudos
4 Replies
BetsySchenck-Gardner
Occasional Contributor
I think you got your double quotes and single quotes messed up.  Try this:

content+="<td><a href="http://surveyor.slco.org/javamap/mrs_test.cfm?"+layerResults.features.attributes['POINT_NAME']+layerResults.features.attributes['LATITUDE_DD']+ " target="_blank">Mon. Ref Sheet</a></td>";
0 Kudos
EmilyLaMunyon
Occasional Contributor
Thanks for the reply Betsy!

Unfortunately this does not work either, I am getting a Firebug error that says:
missing ; before statement
http://surveyor.slco.org/javamappdf/index_tabs.html
Line 514
0 Kudos
danbecker
Occasional Contributor III
building html strings can be tricky; use of double vs single quote

this should work
content+="<td><a href='http://surveyor.slco.org/javamap/mrs_test.cfm?"+layerResults.features.attributes['POINT_NAME']+layerResults.features.attributes['LATITUDE_DD'] + " target='_blank'>Mon. Ref Sheet</a></td>"; 


In js, you can't have a string containing double quote "; the string has to contain single quote ' like this
var str = "<a href='myurl'>text</a>"; // <-- single quotes around href attribute, inside of " "
0 Kudos
EmilyLaMunyon
Occasional Contributor
Thanks, that worked!!! I appreciate your time:)
0 Kudos