我是javascript和网络地图的新手。我正在尝试创建一个显示城市周围壁画的地图。单击该点时,我希望弹出地图图像。这是我到目前为止所做的:
var address = feature.properties.address || 'Unnamed address';
var artist = feature.properties.artist || '(Unknown)';
var year = feature.properties.Year|| '(Unknown)';
var photo = feature.properties.image|| '<P>Photo not available</P>';
var titleHtml = '<p style="font-size:18px"><b>' + address + artist +'</b></p>';
document.getElementById('summaryLabel').innerHTML = titleHtml;
document.getElementById('muralImage').innerHTML = '<img scr='+ photo + '/>'
L.DomEvent.stopPropagation(e); // stop click event from being propagated further
}
});
}
map.addEventListener('click', function(e) {
if (selection) {
if (selectedLayer === muralsLayer) selection.setIcon(iconByPassday(selectedFeature));
selection = null;
document.getElementById('summaryLabel').innerHTML = '<p>Click a mural on the map to get more information.</p>';
document.getElementById('muralImage').innerHTML = ''
}
});
}
对我来说很明显,以下是错误的,但我不知道如何解决它。
document.getElementById('muralImage').innerHTML = '<img scr='+ photo + '/>'