簡體   English   中英

帶有自定義編號的Google Map Marker

[英]Google Map Marker with custom numbering

我有一個Google Maps標記功能,可以像這樣在地圖上成功創建標記:

 // A function to create the marker and set up the event window
  function createMarker(point,html) {
    var marker = new GMarker(point,{title:html});
    GEvent.addListener(marker, "click", function() {
      marker.openInfoWindowHtml(html);
    });
    return marker;
  }

這是退出代碼的tinyurl: http : //tinyurl.com/b8f9b4l

使用此解決方案: Google地圖:標記中的地名?

我已經更新了這一行代碼,但是沒有編號。 我究竟做錯了什么?

var marker = new GMarker(point,{title:html,icon:'icon: \'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld='+ (position) +'|FF776B|000000',});

icon屬性只需要是url。 您不需要多余的“ icon:”,並且應該在末尾刪除多余的逗號(IE在找到懸空的逗號時似乎拋出異常)。 另外,您不需要括號,但可能不會對您造成任何傷害。

{
title:html,
icon: 'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=' + position +'|FF776B|000000'
}

我明白你的主意了。 Idk為什么他/她對此有所了解。 多余的“圖標:”將其弄亂了。

嘗試進行此測試,它應該確保url中的變量沒有任何問題。

{
title:html,
icon: 'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=4|FF776B|000000'
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM