我有一个网站,我列出会议。它们显示在谷歌地图上。我有两页运作良好,一个与本周的所有会议(多个制造商)和另一个只有一个会议。虽然我没有更改代码,但是有多个标记的代码停止工作。
这是不再有效的页面; 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));
}
答案 0 :(得分:1)
Firebug说你的一个地点没有未转义的文字。
生成的HTML中的第291行,第60列。它特别是西安中国。
你想要转义你放在那个数组中的字符串。