Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function markOnMap(x, y) {
- geocoder = new google.maps.Geocoder();
- latlng = new google.maps.LatLng(x, y); //center the map to the coordinates of the searched address
- var myOptions = {
- center: latlng,
- zoom: 8,
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- mapTypeControl: false
- }
- map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
- var markers = document.getElementById('marker').value;
- var mapPoints = $.parseJSON(markers);
- var marker = new Array();
- i = 0;
- $.each(mapPoints, function() {
- var latlng = new google.maps.LatLng(this.lat, this.lng);
- marker[i] = new google.maps.Marker({
- map: map,
- draggable: true,
- position: latlng,
- content: '<b>Name : </b>' + this.name, //very important
- });
- google.maps.event.addListener(marker[i], 'click', function() {
- infowind = new google.maps.InfoWindow({
- content: this.content,
- });
- infowind.open(map, this);
- });
- i++;
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement