-1
我有一個網站,我列出了會議。他們顯示在谷歌地圖上。我有兩頁工作得很好,其中一個是本週的所有會議(多個製作人),另一個只有一個會議。雖然我沒有更改代碼,但具有多個標記的代碼停止工作。谷歌地圖突然停止工作,只爲多個標記
以下是不再工作的頁面; www.biomeeter.com/index6fixed.php 這是隻有1個標記的工作頁面; http://www.biomeeter.com/biologymeetingsdatabase.php?meeting_id=1060
這是多職位的代碼。不知何故,如果我限制(不在下面的代碼中)的PHP結果只有1,地圖的作品。所以不知怎的,似乎有分離問題或類似標記之間的問題......我無法弄清楚如何解決這個問題,如果有任何建議,這將是真棒!
<div id="map" style="width: 550px; height: 370px;"></div>
<script type="text/javascript">
var locations = [
<?php
$result = mysql_query("SELECT * FROM meetings WHERE YEARWEEK(start_date) = YEARWEEK(CURRENT_DATE) OR YEARWEEK(end_date) = YEARWEEK(CURRENT_DATE)");
while($row = mysql_fetch_array($result))
{
$lat = $row['langitude'];
$long = $row['longitude'];
$name = $row['meeting_name'];
$namewithoutbackspaces = str_replace("'", "", "$name");
$meeting_id = $row['meeting_ID'];
$city = $row['city'];
$country = $row['country'];
$website= $row['website'];
echo "['$namewithoutbackspaces </br> $city,$country </br> <a href=\"biologymeetingsdatabase.php?meeting_id=$row[meeting_ID]\" target=\"_blank\" >more info</a></u>', $lat, $long, 1],";
}
?>
];
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 1,
center: new google.maps.LatLng(38.41885, 9.12166),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow();
var bioImage = new google.maps.MarkerImage('gif files/index/marker.png',
// This marker is 20 pixels wide by 32 pixels tall.
new google.maps.Size(21, 43),
// The origin for this image is 0,0.
new google.maps.Point(0,0),
// The anchor for this image is the base of the flagpole at 0,32.
new google.maps.Point(20, 32));
var pinColor = "FA2222";
var pinImage = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|" + pinColor,
new google.maps.Size(21, 43),
new google.maps.Point(0,0),
new google.maps.Point(10, 34));
var marker, i;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map,
icon: bioImage
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
謝謝埃裏克,這是一個簡單的修復! –