IrisKant: Parameter in Callback-Funktion übergeben

Beitrag lesen

Ich würde gern den Icon-Text für jedes Icon auf der Karte ändern, stelle mich aber irgendwie zu blöd an. Ihr seht in der LoadMap-Funktion wie ich versuche Variable tex zu ändern, was aber so nicht geht. Bitte um Hilfe...

  
<script type="text/javascript">  
         var myMap = null;  
         var tex = "Text";  
         var jb = new VELatLong(52, 12);  
         function LoadMap()  
         {  
            myMap = new VEMap("mapDiv");  
            myMap.LoadMap();  
  
            tex = "Text1";  
            StartGeocoding("Halle-Saale");  
            tex = "Text2";  
            StartGeocoding("Berlin HBf");  
            tex = "Text3";  
            StartGeocoding("Biederitz");  
         }  
  
         function UnloadMap()  
         {  
            if (myMap != null) {  
               myMap.Dispose();  
            }  
         }  
  
         function StartGeocoding( address )  
         {  
          myMap.Find(null,    // what  
                     address, // where  
                     null,    // VEFindType (always VEFindType.Businesses)  
                     null,    // VEShapeLayer (base by default)  
                     null,    // start index for results (0 by default)  
                     null,    // max number of results (default is 10)  
                     null,    // show results? (default is true)  
                     null,    // create pushpin for what results? (ignored since what is null)  
                     false,    // use default disambiguation? (default is true)  
                     null,    // set best map view? (default is true)  
                     GeocodeCallback );  // call back function  
         }  
         function GeocodeCallback(shapeLayer, findResults, places, moreResults, errorMsg)  
         {   // if there are no results, display any error message and return  
          if(places == null)  
          {  
           alert( (errorMsg == null) ? "Kein echtes Ergebnis gefunden" : errorMsg );  
           return;  
          }  
          var bestPlace = places[0];  
          var location = bestPlace.LatLong;  
          var newShape = new VEShape(VEShapeType.Pushpin, location);  
          var desc = "Latitude: " + location.Latitude + "<br>Longitude:" + location.Longitude;  
          newShape.SetDescription(desc);  
          newShape.SetTitle(bestPlace.Name);  
          var icon = "<div style='font-size:12px;border:solid 1px" +  
                     "Black;background-color:Aqua;width:25px;'>"+tex+"</div>"; //  
          myMap.ShowMessageBox = false;  
          newShape.SetCustomIcon(icon);  
          myMap.AddShape(newShape);  
          myMap.SetCenterAndZoom(jb, 6);  
         }  
      </script>