javascript - Google Maps will not display Marker -


I am using Google Maps API v = 3 (v = 2, using the same problem). I have tried the latest Chrome, latest Firefox, the latest IE 11. I am able to display a map and pan in a new center, but I can not get a marker to display me. Here are the script headers:

  & lt; Script src = "http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js" type = "text / javascript" & gt; & Lt; / Script & gt; & Lt ;! - Load Google Maps Javascript API - & gt; & Lt; Script src = "http://maps.google.com/maps?file=api&v=3" type = "text / javascript" & gt; & Lt; / Script & gt;  

And when the user clicks on a particular location in a table, the following function applies. There is a map on the page, and the map takes you to the new location, but the marker never appears.

  Function SetmapConverter (map, latitude, longitude) {var center = new google.maps .LatLng (latitude, longitude); Map.panTo (center); Var marker = new google.maps.marker ({status: center, map: map, title: 'here'}); }  

Does anyone see a problem here? Thank you.

I have created a very simple page that shows the problem. Load the page, click any long-long link and see the map in a new place - but no marker is displayed. The message is:

"itemprop =" text ">

solution after both an updated Google Maps API specification and a different syntax for the initial map Is the creation My sample link has been updated to show the work version.

Good:

  & lt; Script src = "http://maps.google.com/maps/api/js?sensor=false" type = "text / javascript" & gt; & Lt; / Script & gt; Function initialize () {var center = new google.maps.LatLng (37.3000, -122.0000); Mymap = new google.maps.Map (document.getElementById ("map_div"), {zoom: 11, center: center, mapTypeId: google.maps.MapTypeId.ROADMAP}); Marker = new google.maps.marker ({status: center, map: mymap, title: 'here'}); }  

Started with bad code i here:

   

Although it can generate a map and calls map.setCenter () or map.panTo (), it was unable to display a marker. Besides, when I changed the API script to the new format, my map DIV then became solid white. And with the old encryption function the new API script format gave me brown.

So, the old API designation is fine with old map creation, but markers do not just display. With new map creation the new API designation also allows me to see the markers.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -