RE: Object Required: map
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=JavascriptshowAddress(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 -~--~~~~--~~--~--~---
Re: Object Required: map
Larry, Now I understand the problem but am unsure how to fix. Any suggestions? Thanks On Dec 10, 10:49 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Dec 10, 7:33 am, mosherjm [EMAIL PROTECTED] wrote: 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.. Not required if you provided a link (which you did)... Your initialize function which initializes the map variable is run by the body onload event which happens after the page finishes loading. The calls to showAddress are inline and are executed as the page is loading, before that variable is set up. -- Larry --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Object Required: map
Your showaddress is getting called, before initialize is run. Hence map is null. mosherjm schrieb: 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=JavascriptshowAddress(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 -~--~~~~--~~--~--~---
Re: Object Required: map
On Dec 10, 7:59 am, mosherjm [EMAIL PROTECTED] wrote: Larry, Now I understand the problem but am unsure how to fix. Any suggestions? There are many ways to fix it, how you fix it depends on your understanding (and is really a basic javascript/programming question, not having anything to do with the map API). One way would be to move your showAddress calls into the initialize function so they run after the map variable is set up. -- Larry Thanks On Dec 10, 10:49 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Dec 10, 7:33 am, mosherjm [EMAIL PROTECTED] wrote: 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.. Not required if you provided a link (which you did)... Your initialize function which initializes the map variable is run by the body onload event which happens after the page finishes loading. The calls to showAddress are inline and are executed as the page is loading, before that variable is set up. -- Larry- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
RE: Object Required: map
That of course is the cause of the bug, but it leaves open a mystery: How in the world did you figure that out? Do you have some magical talent at this? I spent hours and didn't find it! And of course you don't have a magical talent, any more than I do. Yet we somehow both found the problem in about a minute's work - simply because we have good debugging tools like Firebug. That's why I highly recommend not just providing the answer to a question like this, but explaining what tools you used to find it, and educating the OP on what these tools are and how to use them. To paraphrase an old saying, Give a man a bug fix, and you've fixed his bug today. Teach him how to use a debugger, and he'll be able to fix his own bug next time. :-) -Mike From: [EMAIL PROTECTED] Your initialize function which initializes the map variable is run by the body onload event which happens after the page finishes loading. The calls to showAddress are inline and are executed as the page is loading, before that variable is set up. -- Larry --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Object Required: map
On Dec 10, 9:21 am, Michael Geary [EMAIL PROTECTED] wrote: That of course is the cause of the bug, but it leaves open a mystery: How in the world did you figure that out? Do you have some magical talent at this? I spent hours and didn't find it! And of course you don't have a magical talent, any more than I do. Yet we somehow both found the problem in about a minute's work - simply because we have good debugging tools like Firebug. That's why I highly recommend not just providing the answer to a question like this, but explaining what tools you used to find it, and educating the OP on what these tools are and how to use them. To paraphrase an old saying, Give a man a bug fix, and you've fixed his bug today. Teach him how to use a debugger, and he'll be able to fix his own bug next time. :-) But... I didn't use a debugger. I looked at the error message reported in IE Firefox, then at his code and told him the problem I saw... Although if I did use a debugger, I would have said so. I do get tired of saying if you look in the error console in firefox or Opera you will see... And thank you for adding your two cents, hopefully it will help. -- Larry -Mike From: [EMAIL PROTECTED] Your initialize function which initializes the map variable is run by the body onload event which happens after the page finishes loading. The calls to showAddress are inline and are executed as the page is loading, before that variable is set up. -- Larry- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Object Required: map
Thanks for your suggestions. I've made some changes to the page and it helped somewhat. Instead of calling the showAddress function inline, I am now calling it from within the initialize() function. This seems to have cleared up the Object Required error. However, in IE it is giving an javascript error at a line beyond the bounds of the page which i can't figure out and displaying no Marker points. In Firefox it is not displaying the map properly at all. I installed the Firebug add-on as suggested, but there are no errors encountered in Firefox. Please take another gander at the updated code and respond if you have any suggestions. http://woodsite.peak-systems.net/properties/search.asp On Dec 10, 12:34 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Dec 10, 9:21 am, Michael Geary [EMAIL PROTECTED] wrote: That of course is the cause of the bug, but it leaves open a mystery: How in the world did you figure that out? Do you have some magical talent at this? I spent hours and didn't find it! And of course you don't have a magical talent, any more than I do. Yet we somehow both found the problem in about a minute's work - simply because we have good debugging tools like Firebug. That's why I highly recommend not just providing the answer to a question like this, but explaining what tools you used to find it, and educating the OP on what these tools are and how to use them. To paraphrase an old saying, Give a man a bug fix, and you've fixed his bug today. Teach him how to use a debugger, and he'll be able to fix his own bug next time. :-) But... I didn't use a debugger. I looked at the error message reported in IE Firefox, then at his code and told him the problem I saw... Although if I did use a debugger, I would have said so. I do get tired of saying if you look in the error console in firefox or Opera you will see... And thank you for adding your two cents, hopefully it will help. -- Larry -Mike From: [EMAIL PROTECTED] Your initialize function which initializes the map variable is run by the body onload event which happens after the page finishes loading. The calls to showAddress are inline and are executed as the page is loading, before that variable is set up. -- Larry- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---