2017-06-13 23 views
-1

私はMySQLテーブルに基づいてマーカーを使用してマップを作成しました。 位置はテーブルにあります。 今、私はInfoWindowのHTMLを地図上のInfoWindowに表示しないので、InfoWindowにHTMLを書きたいと思います。GoogleマップHTML InfoWindowを使用したMySQLマップ

downloadUrl('inc/map_bridge.php', function(data) { 
     var xml = data.responseXML; 
     var markers = xml.documentElement.getElementsByTagName('marker'); 
     Array.prototype.forEach.call(markers, function(markerElem) { 
      var name = markerElem.getAttribute('name'); 
      var ide = markerElem.getAttribute('id'); 
      var desc = markerElem.getAttribute('beschreibung'); 
      var type = markerElem.getAttribute('art'); 
      var link = '<p>Klicke für weitere infos: <a href="http://link.de">Hier</a>'; 
      var point = new google.maps.LatLng(
       parseFloat(markerElem.getAttribute('lat')), 
       parseFloat(markerElem.getAttribute('lng'))); 


      var infowincontent = document.createElement('div'); 
      var strong = document.createElement('strong'); 
      strong.textContent = 'ID' + ide + ': ' + name 
      infowincontent.appendChild(strong); 
      infowincontent.appendChild(document.createElement('br')); 

      var text = document.createElement('text'); 
      text.textContent = desc + link 
      infowincontent.appendChild(text); 
      var icon = customLabel[type] || {}; 
      var marker = new google.maps.Marker({ 
      map: map, 
      position: point, 
      label: icon.label 
      }); 


      marker.addListener('click', function() { 
      infoWindow.setContent(infowincontent); 
      infoWindow.open(map, marker); 
      }); 
     }); 
     }); 
    } 

それだけなので示しています ショーの例の絵

[1]

は 'beschreibung' は、SELECTの結果であった場合、私は、MySQL-表に

first line<br>second line 

答えて

0

を持って、次のSQLでは、その理由はエスケープされているSELECT SQLの結果です。

(私は評判が足りませんので、回答フォームに記入してください)

関連する問題