1<apex:page >23<meta name= "viewport" content= "initial-scale=1.0, User-scalable=no"/>4<script type= "Text/javascript" src= "Http://maps.google.cn/maps/api/js?sensor=false" ></script>5<script type= "Text/javascript" >6 functionmyload () {7 8 varLat = 23.14746;9 varLNG = 113.34175376;Ten One varMYLATLNG =Newgoogle.maps.LatLng (lat, LNG); A varMyoptions = { -Zoom:15, - CENTER:MYLATLNG, the MapTypeId:google.maps.MapTypeId.ROADMAP - }; - varMap =NewGoogle.maps.Map (document.getElementById ("Map"), myoptions); - + varMarker =NewGoogle.maps.Marker ({ - POSITION:MYLATLNG, +Draggable:true A }); at marker.setmap (map); - - varWin2 =NULL; - //added listen each move generates a new win1, but overlaps overlay; -Google.maps.event.addListener (marker, ' dragend ',function() { - varWin1 =NewGoogle.maps.InfoWindow ({ inContent: "Finance Economics Degree:" + marker.position.lat () + "+" Latitude: "+marker.position.lng () - }); to win1.open (map, marker); + //every time you close the last one, there will be no repetition; - if(win2) { the win2.close (); *}//renamed the current Infowindow; $Win2 =win1;Panax Notoginseng }); - } theWindow.onload =Myload; +</script> A the<body> +<style> - #map { $ width:500px; $ height:400px; - float: Left; - } the</style> -<div id= "Map" ></div>Wuyi</body> the</apex:page>
is to add a listen to the marker icon
Google.maps.event.addListener (marker, ' dragend ', function
You can also ' dragstart ' each time the move ends by closing the last Infowindow to open a new Infowindow and then invoke the LAT (); LNG (); method, so each time to obtain a new latitude and longitude;
These two methods are very important;
Speaking of important, there is one more important thing, you must use IE to see the effect;
Beginner SFDC Create a Google map (add a small box on the marker small icon Infowindow can change text)