我正在从 mysql 数据库中获取我的坐标,如下所示
(<?php echo $_Mylat?>, <?php echo $_Mylon?>)
(<?php echo $_Mylat2?>, <?php echo $_Mylon2?>)
当我绘制地图时,它显示了两个点和方向,如下面的代码所示
function initialize() {
var mapOptions = {
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: center
};
map = new google.maps.Map(document.getElementById('map_canvas'),
mapOptions);
for (var i=0; i<a.length;i++)
{
marker = new google.maps.Marker({
map:map,
draggable:true,
animation: google.maps.Animation.DROP,
position: a[i]
});
}
var flightPlanCoordinates = [
new google.maps.LatLng(<?php echo $_Mylat?>, <?php echo $_Mylon?>),
new google.maps.LatLng(<?php echo $_Mylat2?>, <?php echo $_Mylon2?>)
];
例如,当我单击或将鼠标悬停在标记上时,我希望出现一个消息框,但它不起作用,有人可以帮我更正代码吗
var contentstring = 'hey,this is my location'
var infowindow = new google.maps.InfoWindow ({
content:contentstring
})
google.maps.event.addListener(??????,'click',function(){
infowindow.open(map,????????);});