Hi All,I am trying to point to an external JavaScript file from my main JS code. The external file contains code to run Navigation Toolbar.To load it into my main code, I have defined a function called loadjs().Although I do not get any errors as far as pointing to the file is concerned, the external file does not seem to load. My Navigation toolbar buttons continue to be non-functional.I am attaching the code for reference. loadjs() is placed at the bottom after map.addlayers.Any suggestions are appreciated!Thanks.Jasraj<script> var djConfig = {
parseOnLoad: true, packages: [{ "name": "agsjs", "location": "http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/latest/build/agsjs/" }] }; </script> <script src="http://js.arcgis.com/3.9/"> </script> <script> var map; var navToolbar; require([ "esri/map", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/ImageServiceParameters", "dojo/_base/connect", "dojo/dom", "dojo/parser","dojo/on", "dojo/_base/Color", "esri/geometry/Extent", "esri/layers/FeatureLayer", "esri/layers/ArcGISTiledMapServiceLayer", "esri/symbols/SimpleFillSymbol", "esri/renderers/ClassBreaksRenderer", "agsjs/dijit/TOC", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "esri/toolbars/navigation", "dijit/registry", "dijit/Toolbar", "dijit/form/Button", "dojo/fx", "dojo/domReady!" //"dojo/domReady!" ], function(Map, ArcGISDynamicMapServiceLayer, ImageParameters, connect, dom, parser, on, Color, Extent, FeatureLayer, ArcGISTiledMapServiceLayer, SimpleFillSymbol,ClassBreaksRenderer, TOC, BorderContainer, ContentPane, Navigation, registry, Toolbar, Button) { parser.parse(); //var navToolbar; map = new Map("mapDiv", { sliderOrientation : "horizontal" }); var imageParameters = new ImageParameters(); imageParameters.format = "PNG"; //set the image type to PNG24, note default is PNG8. //Takes a URL to a non cached map service. var dynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://vm-gisdev.personcounty.local/arcgis/rest/services/TaxWebApp/Tax_Web_Application/MapServer", { "opacity" : 1, "imageParameters" : imageParameters }); map.addLayer(dynamicMapServiceLayer); featLayer1 = new FeatureLayer("http://vm-gisdev.personcounty.local/arcgis/rest/services/TaxWebApp/Tax_Web_Application/MapServer/1", { mode: FeatureLayer.MODE_SNAPSHOT, outFields: ["*"] }); /* dynaLayer1 = new FeatureLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/0", { mode: FeatureLayer.MODE_SNAPSHOT, outFields: ["*"] });*/ map.on ('layers-add-result', function (evt) { // overwrite the default visibility of service. // TOC will honor the overwritten value. //dynamicMapServiceLayer.setVisibleLayers ([2, 5, 8, 11]); //try { toc = new TOC({ map: map, layerInfos: [{ layer: featLayer1, title: "" }, { layer: dynamicMapServiceLayer, title: "" } ] }, 'tocDiv'); toc.startup() }); map.addLayers([featLayer1]); // Function to Call an External JS file - NavToolbar.js function loadjs(){ var script=document.createElement('script'); script.type='text/javascript'; script.src='C:/inetpub/wwwroot/TaxWebApp/Code/NavToolbar.js'; varhead=document.getElementByTagName("head")[0]; head.appendChild(script); } </script>