1. Install Firebug in your Firefox browser.
2. Enable the Console and Script tabs in Firebug.
3. Load your page and verify that you get a "map is null" error.
4. Select the Script tab in Firebug, click Options and turn on the Break on
All Errors option.
5. Reload the page. It should show the map.addControl() line where the error
occurs.
6. At the top of the Firebug panel, note where it says:
      showAddress < search.asp()
7. Click on search.asp().

Now you should see the problem. You are calling showAddress() directly from
inline code in your page, before creating the map.

Note: Do not just use the answer I gave after those seven steps. Do not just
use Larry's answer either! We are not magicians with some special talent. We
merely have good tools.

Make sure you follow the steps, so that you are set up for Firebug
debugging. Firebug showed me the problem in 60 seconds; it can do the same
for you.

If anything wasn't clear about how to set up Firebug, give me a shout back
and I'll clarify.

-Mike

> From: mosherjm
> 
> I am getting a Javascript object required error and can't 
> seem to figure it out after hours of trying.  The error is 
> occuring every time the showAddress function is called at the 
> map.setCenter line.
> 
> LINK:  http://woodsite.peak-systems.net/properties/search.asp
> 
> Any help is appreciated.  Thank you.
> 
> 
> 
> 
> 
> 
> 
> Here is a javascript snippet......
> 
> <script type="text/javascript">
> 
> var map = null;
> var geocoder = null;
> geocoder = new GClientGeocoder();
> 
> function initialize() {
>       if (GBrowserIsCompatible()) {
>               map = new GMap2(document.getElementById("map"));
>       map.setCenter(new GLatLng(36.9, -76.2), 11);
>               map.addControl(new GSmallMapControl());
>               map.addControl(new GMapTypeControl());
>       }
> }
> 
> function showAddress(lat_long, InfoWindowHtml) {
>       if (lat_long != "")
>       {
>               var point = new GLatLng(lat_long);
>               map.setCenter(point, 11);
>               var marker = new GMarker(point);
>               map.addOverlay(marker);
>               marker.bindInfoWindowHtml(InfoWindowHtml);
>       }
> }
> </script>
> 
> 
> 
> Then in the HTML I have a series of calls to showAddress like this....
> 
> <script language="Javascript">showAddress(foo, bar);</script>
> 
> 
> and a map....
> 
> <div id="map" style="width:100%;height:100%"></div>
> > 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to Google-Maps-API@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to