I have a problem displaying Google Maps information when clicking outside the map, but if I click on a marker inside the map If I click, Google Maps information may be displayed.
function onload () {var st = getURLParameters ("man"); Var kd_link = getURLParameters ("kd"); If (window.XMLHttpRequest) {xmlhttp = new XMLHttpRequest (); } And {xmlhttp = new ActiveXObject ("Microsoft.XMLHTTP"); } Var dt = ""; Xmlhttp.open ("GET", "hasil.xml", false); Xmlhttp.send (); XmlDoc = xmlhttp.responseXML; Var tbl = xmlDoc.documentElement.getElementsByTagName ('page'); Var map = new google.maps.Map (document.getElementById ('map'), {zoom: 15, center: new google.maps.LatLng (-7.8711188835883945, 112.52471923828125), type the map: google.maps.MapTypeId.ROADMAP // ROADMAP // HYBRID}); Var infowindow = new google.maps.InfoWindow (); Var Glamor = []; Var marker, i; Linked function link (i) {GEvent.trigger (gmarkers [i], "click"); } Var kde; Var nm; Var l1; Var l2; Var bk; (I = 0; i & lt; tbl.length; i ++) {kde = xmlDoc.getElementsByTagName ("code") [i] .childNodes [0] .nodeValue; Nm = xmlDoc.getElementsByTagName ("Nama") [i] .childNodes [0] .nodeValue; L1 = xmlDoc.getElementsByTagName ("lat") [i] .childNodes [0] .nodeValue; L2 = xmlDoc.getElementsByTagName ("long time") [i] .childNodes [0] .nodeValue; BK = xmlDoc.getElementsByTagName ("BK") [I] .childNodes [0] .nodeValue; Marker = new google.maps.marker ({status: new google.maps.LatLng (l1, l2), animation: one, icon: bk, map: map}); Google.maps.event.addListener (Marker, 'click', (function (marker, i) {return function () {infowindow.setContent (xmlDoc.getElementsByTagName ("name") [i] .childNodes [0] .nodeValue) ; Infowindow.open (map, marker);}}) (marker, i)); Gmarkers [i] = marker; }} This is my code, when I try to call a Google Map information marker.
& lt; A href = "javascript: linkclicked ('0')" & gt; Try & lt; / A & gt; It can not be displayed ... please give me the solution ??
You can not link the linked function from your link, because you have the function in the onload function Is defined.
If you use JavaScript in your Chrome browser or in the Firefox browser, the Firebug plugin also console, you will see an error which is not defined as Linked,
If the code changes, this function is normal and Glacer will also work,
Your code should look like this:
var gmarkers = []; Linked function link (i) {google.maps.event.trigger (gmarkers [i], "click"); } Function onload () {var st = getURLParameters ("man"); Var kd_link = getURLParameters ("kd"); If (window.XMLHttpRequest) {xmlhttp = new XMLHttpRequest (); } And {xmlhttp = new ActiveXObject ("Microsoft.XMLHTTP"); } Var dt = ""; Xmlhttp.open ("GET", "return.xml", incorrect); Xmlhttp.send (); XmlDoc = xmlhttp.responseXML; Var tbl = xmlDoc.documentElement.getElementsByTagName ('page'); Var map = new google.maps.Map (document.getElementById ('map'), {zoom: 15, center: new google.maps.LatLng (-7.8711188835883945, 112.52471923828125), type the map: google.maps.MapTypeId.ROADMAP // ROADMAP // HYBRID}); Var infowindow = new google.maps.InfoWindow (); Var marker, i; Var KDE; Var nm; Var l1; Var l2; Var BK; (I = 0; i & lt; tbl.length; i ++) {kde = xmlDoc.getElementsByTagName ("code") [i] .childNodes [0] .nodeValue; Nm = xmlDoc.getElementsByTagName ("name") [i] .childNodes [0] .nodeValue; L1 = xmlDoc.getElementsByTagName ("lat") [i] .childNodes [0] .nodeValue; L2 = xmlDoc.getElementsByTagName ("tall") [i] .childNodes [0] .nodeValue; Bk = xmlDoc.getElementsByTagName ("bk") [i] .childNodes [0] .nodeValue; Marker = new google.maps.marker ({status: new google.maps.LatLng (l1, l2), animation: one, icon: bk, map: map}); Google.maps.event.addListener (Marker, 'click', (function (marker, i) {return function () {infowindow.setContent (xmlDoc.getElementsByTagName ("name") [i] .childNodes [0] .nodeValue) ; Infowindow.open (map, marker);}}) (marker, i)); Grammakers [I] = Marker; }}
No comments:
Post a Comment