Beginner SFDC Create a Google map (add a small box on the marker small icon Infowindow can change text)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.