I threw your code up onto a test page and it worked in IE8, Firefox, and Chrome.
On Sat, Jan 30, 2010 at 1:25 PM, The_DEADman <[email protected]> wrote: > Someone please help with this error. > Actually my javascript knowledge is near to "null", so I don't know if > I am doing everything right. > > Using tutorials and "hello, world" example from the official Google > Maps v3 API page I have created the webpage receiving the airport name > in the GET-parameters, for example: map.htm?apname="Ben-Gurion > airport" > > After that, I call the standard geocoding function and try to display > the result on the map. > > Everything works fine in Firefox, but I have the same error in > Internet Explorer 8: > > <<< Error: 'google' - definition missing >>> > > It looks to me like the first script (specified with src = ".." > attribute) has failed to load correctly. > > --------------------------------- If this is not the API problem, > still please answer me by mail if you know how to solve that. > > ---| Scripts code (inserted into my <head> tag): > > <script type="text/javascript" src="http://maps.google.com/maps/api/js? > sensor=false"></script> > > <script type="text/javascript"> > var geocoder; > var map; > > var address = new String(); > > function initialize() { > > geocoder = new google.maps.Geocoder(); > var latlng = new google.maps.LatLng(0, 0); > var myOptions = { > zoom: 8, > center: latlng, > mapTypeId: google.maps.MapTypeId.ROADMAP > }; > map = new google.maps.Map(document.getElementById("map_canvas"), > myOptions); > > get_parseGet(); > } > > function makeSpan() > { > var span = document.getElementById("mySpan"); > span.childNodes.item(0).nodeValue=address; > } > > function get_parseGet() > { > var getter = new String(window.location); > > var x = getter.indexOf("=", 0); > > // If no address, show something > if (x==-1) > { > address = "Moscow, Kirpichnaya, 33"; > makeSpan(); > codeAddress(); > > return; > } > else ; > > // getting the airport substring and unescaping > > getter = getter.substring(x+1); > getter = unescape(getter); > > address = getter; > makeSpan(); > codeAddress() > } > > function codeAddress() { > if (geocoder) { > geocoder.geocode( { 'address': address}, function(results, > status) { > if (status == google.maps.GeocoderStatus.OK) { > map.setCenter(results[0].geometry.location); > var marker = new google.maps.Marker({ > map: map, > position: results[0].geometry.location > }); > } else { > alert("Geocode was not successful for the following reason: > " + status); > } > }); > } > } > > </script> > > --- Body contents: > > <body onload="initialize()"> > > <div id="map_canvas" style="width: 640px; height: 480px;"></div> > <br/> > > Showing location of the airport: <span style="font-weight:bold" > id="mySpan">error.</span> > > </body> > > -- > 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%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-maps-js-api-v3?hl=en. > > -- 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.
