dojo在鼠标单击时显示地图坐标

时间:2012-07-25 21:20:34

标签: jquery dojo cross-browser gis

我是新手并将一些东西放在一起为我们的部门开始基于网络的地图。我检查了所有主流浏览器。我找不到任何错误或得到积分。这个脚本有什么问题?

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy for Windows (vers 14 February 2006), see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>
  Your Cool Page With an AGRC Base Map
</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.1/js/dojo/dijit/themes/claro/claro.css">
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.1">
</script>
<script type="text/javascript">
dojo.require("esri.map");
     var map = {}

     var Init = function () {              
     map = new esri.Map("map", { logo: false });              
     var layer = new esri.layers.ArcGISTiledMapServiceLayer(                    
     "http://mapserv.utah.gov/ArcGIS/rest/services/UtahBaseMap-Hybrid/MapServer", 
     { id: "Hybrid" });              map.addLayer(layer);          };
     dojo.ready(Init);    

dojo.connect("map", "onClick", function(evt){ 
//get mapPoint from event and display the mouse coordinates 
var mp = evt.mapPoint; 
dojo.byId("info").innerHTML = mp.x + ", " + mp.y; 
    alert(mp.x);
}); 


</script>
   </head>
<body class="claro">
<div id="map"></div>
<p id="info">
  a
</p>
</body>
</html>

0 个答案:

没有答案