if (map.loaded) { initUI(response); } else { dojo.connect(map, "onLoad", function () { //after map loads, connect to listen to mouse move & drag events dojo.connect(map, "onMouseMove", showCoordinates); dojo.connect(map, "onMouseDrag", showCoordinates); initUI(response); }); }
function initUI(response) { dojo.connect(response.map, "onClick", showCoordinates); ... function showCoordinates(evt) { var mp = esri.geometry.webMercatorToGeographic(evt.mapPoint); alert(mp.x.toFixed(3) + ", " + mp.y.toFixed(3)); }