谷歌地图演示
<script type="text/javascript">
function initialize() {
var myOptions = {
zoom: 11,
center: new google.maps.LatLng(-33.9, 151.2),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map"), myOptions);
var locations = [
['Bondi Beach', -33.890542, 151.274856, 4],
['Coogee Beach', -33.923036, 151.259052, 5],
['Cronulla Beach', -34.028249, 151.157507, 3],
['Manly Beach', -33.80010128657071, 151.28747820854187, 2],
['Maroubra Beach', -33.950198, 151.259302, 1]
];
for (var i = 0; i < locations.length; i++) {
var image = new google.maps.MarkerImage('marker' + i + 'images/13.png',
new google.maps.Size(20, 34),
new google.maps.Point(0, 0),
new google.maps.Point(10, 34));
var location = locations[i];
var myLatLng = new google.maps.LatLng(location[1], location[2]);
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: image,
title: location[0],
zIndex: location[3]
});
}
}
</script>
我正在使用WAMPSERVER,并将13.png存储在images文件夹下(www / tacking / images / 13.png)。我将.php文件放在www / tracking / testing.php下。我的路径是否正确?
请指导我......
答案 0 :(得分:0)
在这一行:
var image = new google.maps.MarkerImage('marker' + i + 'images/13.png'
您正在寻找标记:'marker'+ i +'images / 13.png'
这将是:markerNimages / 13.png
看起来那不是你有PNG文件的地方吗?你说你把它放在images / 13.png中。你怎么摆脱'标记'+我?