I have a page where I'm using the google maps api, and if I use IE,
I'll get this error about 40% of the time:

line: 744
char: 31
error: this.L is null or not an object

If I use firefox, I don't get this error at all.

As best as I can figure, this stems from the
geocoder.getLocations(address, addAddressToMap); method.  If I try the
geocoder.getLocationsAsync(address, addAddressToMap); method found in
many of the examples, I get an error saying that this object doesn't
support this method.

Here's my page:
<%@ LANGUAGE="VBSCRIPT" %>
<%
Response.addHeader "Pragma", "no-store"
Response.CacheControl = "no-store"
Response.Expires = -1%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";  xmlns:v="urn:schemas-
microsoft-com:vml">
  <head>
    <style type="text/css" media="all">
     @import "style.css";
     #label {font-weight:bold}
    </style>
    <title>Map/Directions</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/
>
    <script src="http://maps.google.com/maps?
file=api&v=2.x&key=ABQIAAAAHhYW9MjpTLN0SMi24w8ZKxRBnsrdA8FuUt0zdp24rc2SBpETBxTELE3_2kFqwjEUScO1lTSPp_W7xg"
      type="text/javascript"></script>
    <script type="text/javascript">
        // Create a directions object and register a map and DIV to hold the
    // resulting computed directions

    var map;
    var directionsPanel;
    var directions;
    var address = "<%= Request("address")%>";
    var geocoder = new GClientGeocoder();;
    var svOverlay;
    var sov;

    function initialize(address) {

      if (GBrowserIsCompatible()) {
        var myPano = new
GStreetviewPanorama(document.getElementById("pano"));
        GEvent.addListener(myPano, "error", handleNoFlash);
        map = new GMap2(document.getElementById("map_canvas"));
      }
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(point, 15);
              map.addControl(new GSmallMapControl());
              map.addControl(new GMapTypeControl());
              svOverlay = new GStreetviewOverlay();
              GEvent.addListener(map,"click", function(overlay,latlng)
{
              myPano.setLocationAndPOV(latlng);
        });
            }
          }
        );
      }
     geocoder.getLocations(address, addAddressToMap);
    }

    function getDirections(from) {
      directionsPanel = document.getElementById("route");
      directions = new GDirections(map, directionsPanel);
      directions.load(from + " to " + address);

}

    function handleNoFlash(errorCode) {
      if (errorCode == FLASH_UNAVAILABLE) {
        alert("Error: Flash doesn't appear to be supported by your
browser");
        return;
      }
    }

    function toggleStreet() {
       if (sov==1) {
         map.removeOverlay(svOverlay);
         sov=0;
         } else {
         map.addOverlay(svOverlay);
         sov=1;
         }
}

    function addAddressToMap(response) {
  map.clearOverlays();
  if (!response || response.Status.code != 200) {
    alert("\"" + address + "\" not found");
  } else {
    place = response.Placemark[0];
    point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
    marker = new GMarker(point);
    map.addOverlay(marker);
    address = place.address;
    marker.openInfoWindowHtml("<b>Property Location:</b><br />" +
address);
    document.getElementById("label").innerHTML = "Map of " + address;
  }
}

function printpage()
  {
  window.print()
  }

    </script>
  </head>

  <body onload="initialize('<%= Request("address")%>'); return
false;">

    <table style="position:relative;left:10px;top:10px" border=0
cellpadding="0" cellspacing="10px">
     <tr>
      <td colspan=2>
       <form name="submitMe" action="#"
onsubmit="getDirections(this.addressFrom.value); return false;">
         <p>
           <input type="text" size="60" name="addressFrom"
onclick="this.select();" value="type your address here for
directions" />
           <input type="hidden" name="addr" value="" />
           <input type="submit" value="Go!" /><br />
           click on a street below to show an interactive street view
  
           <input type="button" value="Print this page"
onclick="printpage();" />
           <div id="label"></div>
         </p>
       </form>
      </td>
     </tr>
     <tr>
      <td valign="top">
       <div id="map_canvas" style="width: 4.7in; height: 4in;"></
div><br /><br />
       <div id="pano" style="width: 4.7in; height: 2in;"></div>
      </td>
      <td>
       <div id="route" style="width: 2.3in; height: auto; float:
right; border: 0px solid black;"></div>
      </td>
    </tr>
   </table>


    <br/>
  </body>
</html>
html>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to