【发布时间】:2016-05-11 04:12:50
【问题描述】:
如何更改谷歌地图标记并在我的网站中添加两个标记。
目前我正在使用以下代码:
function init_map(lat,lng,ZmLevel) {
var myOptions = {
zoom:ZmLevel,center:new google.maps.LatLng(lat,lng),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('gmap_canvas'), myOptions);
<?php
$sql = "select * from locator_areas where cid=$city";
$res = mysql_query($sql);
while($row=mysql_fetch_assoc($res)) {
?>
marker = new google.maps.Marker({map: map,position: new google.maps.LatLng(<?php echo $row['latitude']; ?>,<?php echo $row['longitude']; ?>)});
infowindow = new google.maps.InfoWindow({
content:'<div style="color:#000000;"><?php echo str_replace("\'","`",$row['address']); ?></div>'
});
bindInfoWindow(marker, map, infowindow);
<?php }?>
}
function bindInfoWindow(marker, map, infowindow) {
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
function loadCity() {
var cid = $('#city_name').val();
window.location = "?cid="+cid;
}
我想更改标记,并想为公司的一些新开张网点再添加一个标记
【问题讨论】:
-
谁能帮忙!....
-
如何在数据中标明不同的标记?
标签: javascript php google-maps dictionary google-maps-markers