1
<script type="text/javascript">

    var markers = [ 
     <?php 
     $siteCount = count($content);
     $aaa=0;
     foreach($content as $con){
     $aaa++;
     $address = $con['Country'].','.$con['State_Province_Name'].','.$con['address'];
     $arr = $obj->getCoordinates($address);
     ?>
    ['<?php echo $con['name'];?>', <?php echo $arr['lat'];?>, <?php echo $arr['long'];?>]<?php if($siteCount==$aaa){ echo "\n";}else{ echo ",";  echo "\n";}?>
    <?php } ?>
];
</script>



<script>
function initializeMaps() {

    var latlng = new google.maps.LatLng(<?php if($arrval==''){echo "43.1291";} else{echo $arr['lat'];}?>, <?php if($arrval==''){echo "-77.6717";} else{echo $arr['long'];}?>);
    var myOptions = {
        zoom: 17,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.SATELLITE,
        mapTypeControl: true
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);

    var infowindow = new google.maps.InfoWindow(), marker, i;
    for (i = 0; i < markers.length; i++) {  
        marker = new google.maps.Marker({
            position: new google.maps.LatLng(markers[i][1], markers[i][2]),
            map: map
        });
        google.maps.event.addListener(marker, 'click', (function(marker, i) {
            return function() {
                infowindow.setContent(markers[i][0]);
                infowindow.open(map, marker);
            }
        })(marker, i));

         google.maps.event.addListener(marker, 'mouseover', (function(marker, i) {
            return function() {
                infowindow.setContent(markers[i][0]);
                infowindow.open(map, marker);
                marker.setAnimation(google.maps.Animation.BOUNCE);
            }
        })(marker, i));


         google.maps.event.addListener(marker, 'mouseout', (function(marker, i) {
            return function() {
                infowindow.setContent();
                infowindow.open();

    setTimeout(function(){ marker.setAnimation(null); }, 0);
            }
        })(marker, i));



    }
}



    </script>

这是我的代码

我想从页面鼠标悬停更改鼠标悬停的位置仅在地图上工作

这里我从页面调用函数

<a  href="javascript:google.maps.event.trigger(markers['<?php echo $content1['name'];?>'],'mouseover'); "><?php echo $content1['name'];?></a>

但这不起作用

4

0 回答 0