karthika pommudu

karthika pommudu

  • NA
  • 321
  • 35k

How can I call the specific description in loop.

Dec 26 2018 4:48 AM
<script type="text/javascript">
var markers = [
{
"title": 'Madurai',"lat": '9.9252007',"lng": '78.1197754',"description":'Canters 3MT/4 Wheel', "description1":'Active',"description2": ' TPK Rd, Periyar, Madurai Main, Madurai, Tamil Nadu 625001, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_l.png"
},{
"title": 'Chennai',"lat": '13.0826802',"lng": '80.2707184',"description":'Canters 3MT/4 Wheel',"description1":'Active',"description2": 'Kamaraj nagar, Kakkanji Colony, Kakanji Colony, Perambur, Chennai, Tamil Nadu 600039, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_m.png"
},
{
"title": 'Coimbatore',"lat": '11.0168445',"lng": '76.9558321',"description":'Canter jumbo',"description1":'Active',"description2": ' Sungam Bypass Bridge, Ukkadam Sungam Bypass Rd, Shanmuga Nagar, Ukkadam, Coimbatore, Tamil Nadu 641008, India', "description3":'Direction:Click',"type": 'Lorry',"icon": "Markers/letter_l.png"
}, {
"title": 'Coimbatore',"lat": '11.0247473',"lng": '76.8980371',"description":'Canter jumbo',"description1":'Active',"description2": 'SH167, V.O Nagar, Sri Ram Avenue, Vadavalli, Coimbatore, Tamil Nadu 641041, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_m.png"
}, {
"title": 'Coimbatore',"lat": '11.0763751',"lng": '77.0029839',"description":'Canter jumbo',"description1":'Active',"description2": '1st Cut Road. SMS Marriage Hall Backside, Ramanandha Nagar, Saravanampatty, Coimbatore, Tamil Nadu 641035, India', "description3":'Direction:Click',"type": 'Lorry',"icon": "Markers/letter_l.png"
}, {
"title": 'Madurai',"lat": '10.0843179',"lng": '77.9610158',"description":'Mini-Truck',"description1":'Active',"description2": ' Mettu Neerethan Rd, Vadipatti, Tamil Nadu 625205, India', "description3":'Direction:Click',"type": 'Lorry',"icon": "Markers/letter_m.png"
}, {
"title": 'Thoothukudi',"lat": '8.7641661',"lng": '78.1348361',
"description":'Mini-Truck',"description1":'Active',"description2": ' Balathandayutham Nagar, Thiru V.K.Nagar, Thoothukudi, Tamil Nadu 628008, India', "description3":'Direction:Click',"type": 'Lorry',"icon": "Markers/letter_m.png"
}, {
"title": 'Thoothukudi',"lat": '8.7951820',"lng": '78.1200951',"description":'Canter jumbo',"description1":'Active',"description2": ' Teachers Colony, Indra Nagar, Thoothukudi, Tamil Nadu 628008, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_l.png"
}, {
"title": 'Thoothukudi',"lat": '8.8185087',"lng": '78.1276494',"description":'Canters 3MT/4 Wheel',"description1":'Active',"description2": 'Ram Nagar, Muthammal Colony, Thoothukudi, Tamil Nadu 628002, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_m.png"
}, {
"title": 'Thoothukudi',"lat": '8.8300915',"lng": '78.1472272',"description":'Canter jumbo',"description1":'Active',"description2": ' East Coast Rd, T.Saveriarpuram, Thalamuthu Nagar, Thoothukudi, Tamil Nadu 628002, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_l.png"
}, {
"title": 'Bengaluru',"lat": '12.9715987',"lng": '77.5945627',
"description":'Mini-Truck',"description1":'Active',"description2": 'Address: Gangavara Rd, Kammasandra, Karnataka 562129, India', "description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_m.png"
}, {
"title": 'Kallakurichi',"lat": '11.7387012',"lng": '78.9609096',"description":'Car Carriers(Open Body)',"description1":'Active',"description2": ' Salem - Ulundurpettai Hwy, Emapper, Kallakurichi, Tamil Nadu 606213, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_m.png"
}, {
"title": 'Perambalur',"lat": '11.2409839',"lng": '78.8665733',"description":'Canters 3MT/4 Wheel',"description1":'Active',"description2": ' Golden Gates School Rd, Sungu Pettai, Perambalur, Tamil Nadu 621212, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_l.png"
}, {
"title": 'Dharmapuri',"lat": '12.1065271',"lng": '78.1361409',
"description":'Mini-Truck',"description1":'Active',"description2": '4th cross street, Nehru Nagar St, Collectorate Post, Dharmapuri, Tamil Nadu 636705, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_m.png"
},
{
"title": 'Dharapuram',"lat": '10.7329354',"lng": '77.5218127',"description":'Mini-Truck',"description1":'Active',"description2": ' Madukkampalam - Dharapuram Rd, Tamil Nadu 638673, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_l.png"
}, {
"title": 'Pollachi',"lat": '10.6572737',"lng": '77.0106693',
"description":'Low Bed Trailer',"description1":'Active',"description2": ' Arumugham layout, Makkinampatti, Pollachi, Tamil Nadu 642001, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_m.png"
}, {
"title": 'Karur',"lat": '10.9600778',"lng": '78.0766036',"description":'Mini-van',"description1":'Active',"description2": ' 3rd Cross St, Rayanur, Karur, Tamil Nadu 639007, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_l.png"
}, {
"title": 'Tiruchirappalli',"lat": '10.7904833',"lng": '78.7046725',"description":'Mini-van',"description1":'Active',"description2": ' Market Bus Stop, Railway Colony, Tiruchirappalli, Tamil Nadu 620004, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_m.png"
}, {
"title": 'Pattukkottai',"lat": '10.4252814',"lng": '79.3140301',
"description":'Mini-Truck',"description1":'Active',"description2": ' 162 big bazar street near vns market, Thangavel Nagar, Pattukkottai, Tamil Nadu 614601, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_l.png"
}, {
"title": 'Kumbakonam',"lat": '10.9585391',"lng": '79.3816417',"description":'Car Carriers(Open Body)',"description1":'Active',"description2": ' Kaliamman Koil St, Valayapettai Agraharam, Kumbakonam, Tamil Nadu 612001, India', "description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_m.png"
},
{
"title": 'Chidambaram',"lat": '11.3981936',"lng": '79.6953594',
"description":'Low Bed Trailer',"description1":'Active',"description2": ' Santhi Nagar, Kanagasabai Nagar, Santhi Nagar, Chidambaram, Tamil Nadu 608001, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_l.png"
}, {
"title": 'Velankanni',"lat": '10.6819262',"lng": '79.8436796',"description":'Canters 3MT/4 Wheel',"description1":'Active',"description2": ' ECR MAIN ROAD, VAILANKANNI, ECR, Nagai-Velankanni Rd, Velankanni, Tamil Nadu 611111, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_m.png"
},
{
"title": 'Kochi',"lat": '9.9312328',"lng": '76.2673041',"description":'Canters 3MT/4 Wheel',"description1":'Active',"description2": 'Kumbalam Ferry, Aroor - Thoppumpady Rd, Pambaimoola, Edakochi, Kochi, Kerala 682010, India',"description25":'Direction:Click', "description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_m.png"
}, {
"title": 'Kovilpatti',"lat": '9.1674144',"lng": '77.8767442',
"description":'Mini-Truck',"description1":'Active',"description2": ' Rajiv Nagar 4th St, Rajiv Nagar, Kovilpatti, Tamil Nadu 628501, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_l.png"
}, {
"title": 'Pandalkudi',"lat": '9.3956700',"lng": '78.1079763',"description":'Canters 3MT/4 Wheel',"description1":'Active',"description2":' Pandalkudi, Tamil Nadu 626113, India',"description3":'Direction:Click', "type": 'Lorry',"icon": "Markers/letter_m.png"
}
];
window.onload = function () {
LoadMap();
}
function LoadMap() {
var mapOptions = {
center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var infoWindow = new google.maps.InfoWindow();
var latlngbounds = new google.maps.LatLngBounds();
var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
var legend = document.getElementById("legend");
legend.style.display = "none";
legend.innerHTML = "";
for (var i = 0; i < markers.length; i++) {
var data = markers[i]
var myLatlng = new google.maps.LatLng(data.lat, data.lng);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: data.title,
icon: data.icon,
//animation: google.maps.Animation.DROP
});
(function (marker, data) {
google.maps.event.addListener(marker, "click", function (e) {
infoWindow.setContent("<div class='address' style = 'width: 100%;text-align: left;min-height:40px'>" + data.description + "</div><div class='address1' style = 'Color:#008000; font-weight:bold; width:100%;min-height:20px'>" + data.description1 + "</div><div class='address1' style = 'width:100%;min-height:20px'>" + data.description2 + "</div><div style='text-align: left;'><a href ='https://www.google.co.in/maps/dir//Periyar,+Madurai+Main,+Madurai,+Tamil+Nadu/@9.9114366,78.0800857,13z/data=!3m1!4b1!4m9!4m8!1m0!1m5!1m1!1s0x3b00c57f62727b7b:0x5bddfd54ea244ae7!2m2!1d78.1151052!2d9.9114384!3e0' style = 'text-align: left;color:#ffcd04; font-weight:bold; width: 100%;height:100px'>" + data.description3 + "</a></div>");
infoWindow.open(map, marker);
});
})(marker, data);
latlngbounds.extend(marker.position);
legend.innerHTML += "<div style = 'margin:5px'><img align = 'middle' src = '" + marker.icon + "' />&nbsp;" + marker.title + "</div>";
}
var bounds = new google.maps.LatLngBounds();
map.setCenter(latlngbounds.getCenter());
map.fitBounds(latlngbounds);
}
</script>

Answers (2)