如何使用javascript将iframe作为目标?(地图盒)
我有一张地图,并创建了一个功能层,如下所示:如何使用javascript将iframe作为目标?(地图盒),javascript,iframe,leaflet,mapbox,Javascript,Iframe,Leaflet,Mapbox,我有一张地图,并创建了一个功能层,如下所示: window.map = L.mapbox.map('map', 'example.wefk232sm') .setView([homeLatitude, homeLongitude], initialZoom); var myLayer = L.mapbox.featureLayer().addTo(map); // Pass features to the map myLayer.setGeoJSON(geoJson); var geoJs
window.map = L.mapbox.map('map', 'example.wefk232sm')
.setView([homeLatitude, homeLongitude], initialZoom);
var myLayer = L.mapbox.featureLayer().addTo(map);
// Pass features to the map
myLayer.setGeoJSON(geoJson);
var geoJson = {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
properties: {
title: name,
other: "text",
'marker-color': '#54a743',
'stroke': '#428334',
url: link
},
geometry: {
type: 'Point',
coordinates: [longitude, latitude]
}
]
};
geoJson对象如下所示:
window.map = L.mapbox.map('map', 'example.wefk232sm')
.setView([homeLatitude, homeLongitude], initialZoom);
var myLayer = L.mapbox.featureLayer().addTo(map);
// Pass features to the map
myLayer.setGeoJSON(geoJson);
var geoJson = {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
properties: {
title: name,
other: "text",
'marker-color': '#54a743',
'stroke': '#428334',
url: link
},
geometry: {
type: 'Point',
coordinates: [longitude, latitude]
}
]
};
我可以通过以下方式访问它:
myLayer.setGeoJSON(geojson);
myLayer.on('click', function(e) {
window.open(e.layer.feature.properties.url);
});
当我点击地图上的标记时,url会在一个新窗口中打开。我试图实现的是在一个单独的iframe中打开url
<iframe width="100%" height="700px" frameborder="0" scrolling="no"
name="side" id="side" src="frame_start.php?((parameters in the link))">Your
Browser does not support iframes</iframe>
您的
浏览器不支持iFrame
。。。但我不知道怎么做。有人能帮我吗?非常感谢您抽出时间 使用iframe的
名称
作为打开
的第二个参数:
window.open(e.layer.feature.properties.url,'side');
知道了!非常感谢:)