javascript - Google Maps API only one marker icon appears -
i trying place 2 markers on map. reason 1 of them red marker icon. checked on multiple computers, must note running using wamp server.
the map appears should "marker2" has red marker icon.
here code:
<!doctype html> <html> <head> <title>customer map</title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <meta http-equiv="refresh" content="420"> <style type="text/css"> html, body, #map-canvas { height: 100%; margin: 0px; padding: 0px } .labels { color: orange; background-color: black; font-family: "lucida grande", "arial", sans-serif; font-size: 10px; font-weight: bold; text-align: center; width: 100px; border: 2px solid black; white-space: nowrap;} </style> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="https://jquery-xml2json-plugin.googlecode.com/svn/trunk/jquery.xml2json.js" type="text/javascript" language="javascript"></script> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> <script src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerwithlabel/1.0.1/src/markerwithlabel.js"></script> <script> var map = null; function geocodeaddress(lat, lon, image, custname) { var mylatlng = new google.maps.latlng(lat,lon); var marker = new markerwithlabel({ position: mylatlng, map: map, icon: image, labelcontent: custname, labelanchor: new google.maps.point(22, 0), labelclass: "labels", // css class label labelstyle: {opacity: 0.75} }); } function initialize() { var chicago = new google.maps.latlng(0,0); var mapoptions = { zoom: 2, center: chicago, maptypeid: google.maps.maptypeid.hybrid } map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); geocodeaddress (49.0240107,8.7582988,'http://maps.google.com/mapfiles/ms/micons/red-dot.png',"marker1"); geocodeaddress (30.267153,8.7582988,'http://maps.google.com/mapfiles/ms/micons/red-dot.png',"marker2"); } google.maps.event.adddomlistener(window, 'load', initialize); </script> </head> <body> <div id="map-canvas"></div> </body>
this must bug(i can't tell where).
for suggest use release-version instead of experimental api-version(both markers drawn then):
https://maps.googleapis.com/maps/api/js?v=3&sensor=false
Comments
Post a Comment