开发者

Google Map: Dynamic Array generation javascript

开发者 https://www.devze.com 2023-03-22 21:15 出处:网络
Can any one please advice me, that, i need to generate an array dynamically for google map... I have a lat and long values from my Database. here i would like to built an array with those values like.

Can any one please advice me, that, i need to generate an array dynamically for google map... I have a lat and long values from my Database. here i would like to built an array with those values like...the below one.

var store_locations = new Array();
store_locations = [ 
     new google.maps.LatLng(39.112456,-84.574779),
     new google.maps.LatLng(39.314153,-84.261379),
     new google.maps.LatLng(39.197099,-84.667579),
     new google.maps.LatLng(39.16836,-84.479381)
   ];

The inner par开发者_开发问答t of the square bracket should be dynamic. please advice.


you can use array.push in your cycle

store_locations.push(new google.maps.LatLng(39.112456,-84.574779));


You can easily do this by pushing new elements to the array:

var store_locations = new Array();
store_locations.push(new google.maps.LatLng(39.112456,-84.574779));
0

精彩评论

暂无评论...
验证码 换一张
取 消