thank you for the response, here is the code... <script type="text/javascript"> dojo.require("dijit.dijit"); dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("esri.map"); dojo.require("esri.arcgis.utils"); dojo.require("esri.dijit.Legend"); dojo.require("esri.dijit.Scalebar"); var map; function init() { esri.config.defaults.io.proxyUrl = "/arcgisserver/apis/javascript/proxy/proxy.ashx"; var mapDeferred = esri.arcgis.utils.createMap("e6cb82722b8d4a31a39c053e24ca8789", "map", { mapOptions: { slider: true, nav:false } }); mapDeferred.addCallback(function(response) { map = response.map; //resize the map when the browser resizes dojo.connect(dijit.byId('map'), 'resize', map,map.resize); //add the legend var layers = response.itemInfo.itemData.operationalLayers; if(map.loaded){ initMap(layers); } else{ dojo.connect(map,"onLoad",function(){ initMap(layers); }); } }); mapDeferred.addErrback(function(error) { console.log("Map creation failed: ", dojo.toJson(error)); }); } function initMap(layers){ //add chrome theme for popup dojo.addClass(map.infoWindow.domNode, "chrome"); //add a scalebar var scalebar = new esri.dijit.Scalebar({ map:map, scalebarUnit: 'english' }); //add a legend var layerInfo = dojo.map(layers, function(layer,index){ return {layer:layer.layerObject,title:layer.title}; }); if(layerInfo.length > 0){ var legendDijit = new esri.dijit.Legend({ map:map, respectCurrentMapScale:true, layerInfos:layerInfo },"legend"); legendDijit.startup(); } else{ dojo.byId('legend').innerHTML = 'No operational layers'; } } //show map on load dojo.addOnLoad(init); </script> i really need this, thank you
... View more