-2

这是下面的代码。我不知道如何添加第二个标记,我一直在玩弄它,但我对 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
});

}    
4

1 回答 1

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
});
于 2013-08-28T12:45:29.660 回答