标签:
1 var map; 2 require(["esri/map", "dojo/domReady!"], function(Map) { 3 map = new Map("GHL", { 4 5 zoom: 3, 6 basemap: "topo", 7 logo:false, 8 9 10 }); 11 dojo.connect(map,"onMouseMove",function(e){ 12 var mp = e.mapPoint; 13 var sp = e.screenPoint; 14 dojo.byId("map1").innerHTML = mp.x+"/"+sp.x; 15 dojo.byId("map2").innerHTML = mp.y+"/"+sp.y; 16 }) 17 }); 18 19 20 </script> 21 <body> 22 <div id="GHL"></div> 23 <div id="map1"></div> 24 <div id="map2"></div>
主要关键是,添加绑定事件的方法dojo.connect
该例子可以显示当鼠标滑动在地图上时,会显示两种不同的坐标!
<script>
var map;
require(["esri/map", "dojo/domReady!"], function(Map) {
map = new Map("GHL", {
zoom: 3,
basemap: "topo",
logo:false,
});
dojo.connect(map,"onMouseMove",function(e){
var mp = e.mapPoint;
var sp = e.screenPoint;
dojo.byId("map1").innerHTML = mp.x+"/"+sp.x;
dojo.byId("map2").innerHTML = mp.y+"/"+sp.y;
})
});
</script>
<body>
<div id="GHL"></div>
<div id="map1"></div>
<div id="map2"></div>
</body>
Arc gis api for js 学习随笔之绑定事件鼠标动作
标签:
原文地址:http://www.cnblogs.com/joegaohuanlin/p/5151350.html