我已经搜索过这个问题,但是找不到与此相同的样本。我尝试在不同的位置使用单引号和双引号,但无法使其工作或出错。
我只想让变量myLink在我的弹出窗口中显示链接。谢谢!
else {
var myLink = "http://www.myorg.org/local.html?state=14&local=" + feature.attributes.CITY_NAME;
var CityCountyTemplate = new InfoTemplate("",
"City: ${CITY_NAME} <br/> County: ${COUNTY} <br/> State: ${STATE_NAME} <br/> <strong>Link: </strong><a href=myLink> Results page</a>");
CityCountyTemplate.setTitle("Result");
feature.setInfoTemplate(CityCountyTemplate);
}