这是下面的代码。我无法弄清楚如何添加第二个标记,我已经玩弄了一段时间但我用javascript很糟糕,我真的无法理解它!
$(document).ready(function() {
initializeGoogleMap();
});
// Call this function when the page has been loaded
function initializeGoogleMap() {
var myLatlng = new google.maps.LatLng(45.93986,-85.65181);
var myOptions = {
zoom: 12,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("google-map-location"), myOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map
});
}
答案 0 :(得分:3)
var myLatlng2 = new google.maps.LatLng(45.9,-85.6);
var marker2 = new google.maps.Marker({
position: myLatlng2,
map: map
});
或
var marker2 = new google.maps.Marker({
position: new google.maps.LatLng(45.9,-85.6),
map: map
});