Try this: <div id="map_canvas" style="width:600px;height:500px"></div>
Ralph On Jul 22, 10:43 pm, Venkat Renuka Prasad Sahukara <[email protected]> wrote: > Ok, now that I know that I don't need a key for V3 at all, my code is: > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/> > <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> > <title>Google Maps JavaScript API v3 Example: Directions Travel > Modes</title> > <script type="text/javascript" > src="http://maps.google.com/maps/api/js?sensor=false"></script> > <script type="text/javascript"> > > var map; > var defaultCenter = new google.maps.LatLng(37.7699298, -122.4469157); > > function initialize() { > var myOptions = { > zoom: 14, > mapTypeId: google.maps.MapTypeId.ROADMAP, > center: defaultCenter > }; > map = new google.maps.Map(document.getElementById("map_canvas"), > myOptions); > } > </script> > </head> > <body onload="initialize()"> > <div id="map_canvas"></div> > </body> > </html> > > :( Now, I don't get the error, but just a blank page, no map-canvas or any > tiles. What should I do? > > PS: My localhost runs on IIS 7.5 server on my windows 7 machine. Guess, > something is messed up there... > > Thanks in advance, > Renuka Prasad. > > On Thu, Jul 22, 2010 at 5:12 AM, [email protected] > <[email protected]>wrote: > > > > > On Jul 21, 2:50 pm, Renuka <[email protected]> wrote: > > > Hi, > > > > I recently started with google maps API. I got a key generated for the > > > domain "localhost". My service provider does not give away static ip > > > addresses to non-commercial connections. > > > Of course, google expects a static IP from the network which > > > registered the key. > > > > But, I registered for the key 2 days back and since then, my IP didnot > > > change. My page uses a simple code to just render the map. > > > > <html> > > > <head> > > > > <script type="text/javascript" src="http://maps.google.com/ > > > maps/api/js? > > > sensor=false&key=ABQIAAAAWBPr9nPLAlfFlaaLpfnz6RT2yXp_ZAY8_ufC3CFXhHIE1NvwkxShNKH4EKuy3gDAF6FcmCVNvvD55g"></ > > > keys are not required for v3 of the API. > > > > script> > > > > <script type="text/javascript"> > > > > initialize(); > > > > function initialize() { > > > var myLatlng = new google.maps.LatLng(-34.397, > > > 150.644); > > > var myOptions = { > > > zoom: 8, > > > center: myLatlng, > > > mapTypeId: google.maps.MapTypeId.ROADMAP > > > } > > > var map = new > > > google.maps.Map(document.getElementById("map_canvas"), myOptions); > > > } > > > </script> > > > </head> > > > > <body> > > > <div id="map_canvas"></div> > > > > </body> > > > > </html> > > > > When I hit the page, I get a script error: 'null' is null or not an > > > object. athttp://...staticmaps...../main.js. > > > Now, is the error because my key is invalid as I have a dynamic ip? > > > Don't know. If you post your page to a public webpage, we could run a > > debugger on it and possibly tell you. At this point, you are the only > > one that can do that. > > > Other than the fact you don't need a key for v3, there isn't anything > > I can see that is wrong, but my web browser is a lot better at finding > > errors than my eyes... > > > Although, looking for your call of initialize, I see that it is in the > > wrong place. You want to call initialize once the DOM has been > > completely rendered (usually in the body onload function). > > > -- Larry > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google Maps JavaScript API v3" group. > > To post to this group, send email to > > [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<google-maps-js-api-v3%2b[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/google-maps-js-api-v3?hl=en.- Hide quoted > >text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
