Hi, Im having this problem... whenever I run this web site I cannot make zoom in or zoom out, or even move the map with the pan control, can anyone tell me why is this ? please I've been working with this sample since I found it and I don't know how to solve this problem ... my code<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Measure Distances</title>
<script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.0" type="text/javascript"></script>
<script type="text/javascript">
dojo.require("esri.map");
dojo.require("esri.tasks.geometry");
var map, navToolbar;
var geometryService;
function init() {
//esriConfig.defaults.map.sliderLabel = null;
//var startExtent = new esri.geometry.Extent(-80.0571, 41.3697, -74.4321, 44.0822, map.spatialReference); //new esri.SpatialReference({ wkid: 4326 }));
var map = new esri.Map("map"); //, { extent: FullExtent });
dojo.connect(map, "onLoad", initFunctionality);
map.addLayer(new esri.layers.ArcGISDynamicMapServiceLayer("http://servarcgisprd/ArcGIS/rest/services/MapaBase/MapServer"));
geometryService = new esri.tasks.GeometryService("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
dojo.connect(geometryService, "onLengthsComplete", outputDistance);
// navTool = new esri.toolsbars.Navigation(map);
// dojo.connect(navToolbar, "onExtentHistoryChange", extentHistoryChangeHandler);
}
function initFunctionality(map) {
var tb = new esri.toolbars.Draw(map);
var lengthParams = new esri.tasks.LengthsParameters();
//on draw end add graphic, project it, and get new length
dojo.connect(tb, "onDrawEnd", function (geometry) {
map.graphics.clear();
lengthParams.polylines = [geometry];
lengthParams.lengthUnit = esri.tasks.GeometryService.UNIT_METER;
lengthParams.geodesic = false;
//call GeometryService.lengths() with projected geometry
geometryService.lengths(lengthParams);
var graphic = map.graphics.add(new esri.Graphic(geometry, new esri.symbol.SimpleLineSymbol()));
});
tb.activate(esri.toolbars.Draw.LINE);
}
function outputDistance(result) {
dojo.byId("distance").innerHTML = dojo.number.format(result.lengths[0]) + " metros or " + dojo.number.format(result.lengths[0] / 1000) + " Kilometros";
}
// function extentHistoryChangeHandler() {
// dijit.byId("zoomprev").disabled = navToolbar.isFirstExtent();
// dijit.byId("zoomnext").disabled = navToolbar.isLastExtent();
// }
dojo.addOnLoad(init);
</script>
</head>
<body>
Click and hold down on the map to draw a line that will be added to the map. The application will then use the geometry service to project and compute the length of the line.
<div id="map" ></div>
Distance: <span id="distance"></span>
</body>
</html>