First knowledge SFDC create a Google Map (add marker small icon so that he can go to the latitude and longitude of your input)

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                 9lat = document.getElementById ("{! $Component. Form.pageBlock1.text1}"). Value;Ten                  One                                  ALNG = document.getElementById ("{! $Component. form.pageBlock1.text2}"). Value; -                  -                     varMYLATLNG =Newgoogle.maps.LatLng (lat, LNG); the                 varMyoptions = { -Zoom:15, - CENTER:MYLATLNG, - MapTypeId:google.maps.MapTypeId.ROADMAP +                 }; -                 varMap =NewGoogle.maps.Map (document.getElementById ("Map"), myoptions); +            A                 varMarker =NewGoogle.maps.Marker ({ at POSITION:MYLATLNG, -Draggable:true -                   }); - marker.setmap (map); -                    -                   varWin2 =NULL; in                   //added listen each move generates a new win1, but overlaps overlay; -Google.maps.event.addListener (marker, ' dragend ',function() { to                     varWin1 =NewGoogle.maps.InfoWindow ({ +Content: "Finance Economics Degree:" + marker.position.lat () + "+" Latitude: "+marker.position.lng () -                       }); the win1.open (map, marker); *                     //every time you close the last one, there will be no repetition; $                     if(win2) {Panax Notoginseng win2.close (); -                     } theWin2 =win1; +                 }); A             } theWindow.onload =Myload; +</script> - $<body> $<style> - #map { - width:500px; the height:400px; -                 float: Left;Wuyi               } the</style> -<div id= "Map" ></div> Wu<apex:form id= "Form" > -<apex:pageblock id= "PageBlock1" > About<apex:inputtext id= "Text1"/> $<apex:inputtext id= "Text2"/> -<apex:pageblockbuttons > -<apex:commandbutton onclick= "Myload ()" value= "Change"/> -</apex:pageBlockButtons> A</apex:pageBlock> +<apex:pageblock > the               -                   $</apex:pageBlock> the               the</apex:form> the</body> the</apex:page>

This is actually the two words. Add the two Apex:inputtext input box below, set the ID and then pass {! $Component. Form.pageBlock1.text1} Each level of ID gets, you can get to the address you entered and then locate it.

lat = document.getElementById ("{! $Component. Form.pageBlock1.text1}"). Value;10 LNG = document.getElementById ("{! $Component. form.pageBlock1.text2}"). Value;
There are many places to note in this column
1, must use IE browser to open WIN10 's bad use;
2, I used to get the ID when the browser page by pressing F12, and then select the component you want, it will tell you the ID. The advantage is that you do not need to manually to each level to add ID, the disadvantage is also obvious is every time you change <body></body> inside the content, the ID will change, every time to regain, until I saw someone else write it ....
3, as mentioned in the previous example
Marker.position.lat ()
MARKER.POSITION.LNG () These two methods, chicken easy to use, directly help get to latitude and longitude.
4, this is my most silent error, because this example has just finished loading, there is no input latitude and longitude, so it has a default address, is at sea ... At sea ... Sea...... That I thought had never been loaded out until my master came over and dialed my mouse wheel (zoom) before I saw anything else,
5, is actually can not add button components, as long as the input of new latitude and longitude, enter can jump, this is very magical why enter when the inputtext inside of the things have not been emptied, was retained? Ask for advice!

First knowledge SFDC create a Google Map (add marker small icon so that he can go to the latitude and longitude of your input)

Related Article

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.