2011-03-07 26 views
0

谷歌地圖演示 該標誌不會出現在GMAP

<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 (WWW /黏合/圖像/ 13.png)。我把我的.php文件放在www/tracking/testing.php下。我把我的路徑正確嗎?

請指引我...

回答

0

在這一行:

var image = new google.maps.MarkerImage('marker' + i + 'images/13.png' 

你是在尋找一個標誌: '標記' + I + '圖像/ 13.png'

這將是這樣的:markerNimages/13.png

看起來這不是你有PNG文件的權利?你說你已經把它放在images/13.png中。如果你只是擺脫'標記'+我?

+0

hi DasBoot.thx用於回答。我已經嘗試過,但它仍然無法正常工作..!其實我要從我的數據庫中檢索經緯度,我要去製作GMAP的製作者。之後,我希望所有的製造商路徑/彼此鏈接。你有沒有這樣做的想法?如果是的話,請幫助我,因爲我已經嘗試了幾天。 Thx預先和上帝保佑 – user647527

+0

@user:你有不同的* .png文件爲不同的標記? –