Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple Markers on a Google Map
    text
    copied!<p>I added a google map with two markers (i am just testing), the code is:</p> <pre><code>function load() { var map = new GMap2(document.getElementById("map")); var marker = new GMarker(new GLatLng(&lt;%=coordinates%&gt;)); var marker2 = new GMarker(new GLatLng(31.977211,35.951729)); var html="&lt;%=maptitle%&gt;&lt;br/&gt;" + "&lt;%=text%&gt;"; var html2="&lt;img src='simplemap_logo.jpg' width='20' height='20'/&gt; " + "&lt;%=maptitle%&gt;&lt;br/&gt;" + "&lt;%=text%&gt;" + "Alper"; map.setCenter(new GLatLng(&lt;%=coordinates%&gt;), 5); map.setMapType(G_HYBRID_MAP); map.addOverlay(marker); map.addOverlay(marker2); map.addControl(new GLargeMapControl()); map.addControl(new GScaleControl()); map.addControl(new GMapTypeControl()); marker.openInfoWindowHtml(html); marker2.openInfoWindowHtml(html2); } </code></pre> <p>The problem is, only one markers text is showing (the white triangle with text inside it) the other is not visible, why? Another thing, i have a table of Maps, its like: mapID, mapCoordinates, mapMarkerTitle, mapMarkerText, i can retrieve this table, but i want a way to be able to pass all its records to my javascript and create a Marker for each Map i have in my table, i know this is two much, but can anyone suggest or help me with the code? as i know nothing about javascript :D</p> <p>The HTML OUTPUT is:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt;&lt;title&gt; Untitled Page &lt;/title&gt; &lt;script src="http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=ABQIAAAANgu3GlobW5KtQorgXrnJ_xTHM4EYhrvsce8mdg4KdiCoPfCQKxSOZ_5sjy4O31twg6cxfZqam24TCw" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function load() { var map = new GMap2(document.getElementById("map")); var marker = new GMarker(new GLatLng(32.523251,35.816068)); var marker2 = new GMarker(new GLatLng(31.977211,35.951729)); var html="maen&lt;br/&gt;" + " maen tamemi"; var html2="&lt;img src='simplemap_logo.jpg' width='20' height='20'/&gt; " + "maen&lt;br/&gt;" + " maen tamemi" + "Alper"; map.setCenter(new GLatLng(32.523251,35.816068), 5); map.setMapType(G_HYBRID_MAP); map.addOverlay(marker); map.addOverlay(marker2); map.addControl(new GLargeMapControl()); map.addControl(new GScaleControl()); map.addControl(new GMapTypeControl()); marker2.openInfoWindowHtml(html2); marker.openInfoWindowHtml(html); } //]]&gt; &lt;/script&gt; &lt;script type="text/javascript"&gt; function pageLoad() { } &lt;/script&gt; &lt;/head&gt; &lt;body onload = "load()"&gt; &lt;form name="form1" method="post" action="Xhome.aspx" id="form1"&gt; &lt;div&gt; &lt;input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNDI5NDcxNTY4ZGTjxbb38769ZB2N9Ow9kAzPz2PIqA==" /&gt; &lt;/div&gt; &lt;div id="map" style="width:400px;height:300px" &gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload