9.1.2 leaflet代码如下,可粘贴到沙官网沙箱运行,为什么点击“定位”不会弹出popup框,如何才能让他弹出popup框?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title data-i18n="resources.title_tiledMapLayer4326"></title>
<script type="text/javascript" src="../js/include-web.js"></script>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%">
<div style="position:absolute;left:90px;top:30px;z-index:999">
<input id="pos" value='0,0,名字' type="text">
<input value='定位' type="button" onclick=flytomaker()>
</div>
</div>
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
<script type="text/javascript">
var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
var map, url = host + "/iserver/services/map-world/rest/maps/World";
map = L.map('map', {
crs: L.CRS.EPSG4326,
center: [0, 0],
maxZoom: 18,
zoom: 1
});
L.supermap.tiledMapLayer(url).addTo(map);
function flytomaker(){
var str=document.getElementById('pos').value;
var arrpos=str.split(',');
var c=L.marker([0, 0]).addTo(map).bindPopup(arrpos[2]).openPopup();
}
</script>
</body>
</html>