Problem getting code to function

Discussion created by jdkitzmi on Jun 12, 2012
Latest reply on Jun 27, 2012 by jdkitzmi
I am a novice at JS, but I have done well with Python scripting in the past. I currently have an application set up in ArcServer but am migrating it over to the JavaScript API for more flexibility. I can't seem to get things to work though. I made use of the "Find" tool example script and am attempting to get a geoprocessing task to work as well. Things just don't seem to be connecting somewhere. The draw toolbar never comes up for the geoprocessor and the Find tool won't find as far as I can tell. I've had someone else look over the code and they are also stumped. I figured this group here would be a good place to ask for some help. I'm really hoping to get over this hurdle so I can get this online. Everything is looking good, just not working!

I will admit I'm not the best script writer yet...again, still pretty new at this. And my GP task isn't completely written yet (figured I'd stop where I was since I couldn't get even basic things to work). But if I could get some insight on why things don't seem to be working, that would be great. Thanks!

*Looks like my code is too long so I'll break it up to a second post*

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
        <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
        <title>FiberAnalytics Resource Atlas</title>
        <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.4/js/dojo/dijit/themes/claro/claro.css">
  <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/js/dojo/dojox/layout/resources/FloatingPane.css"> 
            html, body {
                height: 98%;
                width: 98%;
                margin: 0;
                padding: 5px;
                font-family: helvetica, arial, sans-serif;
                font-size: 90%;
   #title {
    background-color: red;
    color: white;
    background-image: url('C:\Users\jdkitzmi\Desktop\NCSU-block.png');
    background-repeat: no-repeat;
    background-position: right;
    background-attachment: fixed;
   #footer {
    background-color: red;
    color: white;
            #leftPane {
                width: 280px;
                overflow: auto
   #mapDiv {
    border: 1px solid #666;
   #status {
    background-color: black;
    color: white;
    padding: 3px;
    border: solid 1px white;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
            /* this line hide layers when out of scale for the inline TOC */
            #scaleDiv .agsTOCOutOfScale {
                display: none;
        <script type="text/javascript">
            var djConfig = {
              parseOnLoad: true,
             // baseUrl: './'
              modulePaths: {
            // if use local copy, make sure the path reference is relative to 'baseUrl', e.g.:
                // 'agsjs': '../build/agsjs'
                'agsjs': 'http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/1.06/build/agsjs'
        <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.4">
        <script type="text/javascript" language="Javascript">
            // uncomment if want dojo widget style checkbox
        <script type="text/javascript">
            var map;
   var backgroundImage;
   var findTask;
   var findParams;
   var gp;
   var selectionToolbar;
            function init() {
              var initialExtent = new esri.geometry.Extent({
                "xmin": -9437935.76180124,
    "ymin": 3588581.46154952,
    "xmax": -8309412.09713561,
    "ymax": 4768846.60774257,
    "spatialReference": {
     "wkid": 102113
              map = new esri.Map("map", {
                extent: initialExtent
     dojo.connect(map,"onUpdateStart", function(){
     dojo.connect(map,"onUpdateEnd", function(){
     dojo.connect(map, 'onLoad', function(theMap) {
      var scalebar = new esri.dijit.Scalebar({
     map: map,
     scalebarUnit: 'english'
      dojo.connect(dijit.byId('map'), 'resize', map, map.resize);
              backgroundImage = new esri.virtualearth.VETiledLayer ({
     bingMapsKey: 'AsF59TXTyT2x5VCmmMSkVXQELSMlWz9y0Uh0VywucgQ8efynmFznfifjFqYd82fr', 
     mapStyle: esri.virtualearth.VETiledLayer.MAP_STYLE_AERIAL_WITH_LABELS
               var resources = new esri.layers.ArcGISDynamicMapServiceLayer("https://gismap.oit.ncsu.edu/ArcGIS/rest/services/jKnight/jdkitzmi_Masters/MapServer", {
                id: 'resources',
                opacity: 0.8
              dojo.connect(map, 'onLayersAddResult', function(results) {
                var toc = new agsjs.dijit.TOC({
                  map: map,
                  layerInfos: [{
                    layer: resources,
                    title: "Resources"
                }, 'tocDiv');