добрый день.
есть такой скрипт:
HTML |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Google Maps JavaScript API Example</title> <script src="http://maps.google.com/maps?file=api&v=2&hl=es;&key=ABСD" type="text/javascript"> </script> <script type="text/javascript"> //<![CDATA[ function load() { if (GBrowserIsCompatible()) { var side_bar_html=""; prov=new Array(); function myclick(i) { alert(i); } var map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng(40.17887331434696, -4.075927734375), 6); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); GEvent.addListener(map,"drag",function (){ var center = map.getCenter(); document.getElementById("message").innerHTML = center.toString(); }); GDownloadUrl("text.xml", function(data){ var XmlDoc=GXml.parse(data); var provinces=XmlDoc.documentElement.getElementsByTagName("marker"); for (var i=0; i<provinces.length; i++){ prov[i]=new Array(); var lat=parseFloat(provinces[i].getAttribute("lat")); var lng=parseFloat(provinces[i].getAttribute("lng")); var pan=parseInt(provinces[i].getAttribute("zoom")); var name=provinces[i].getAttribute("name"); prov[i]["lat"]=lat; prov[i]["lng"]=lng; prov[i]["pan"]=pan; side_bar_html += '<a href="javascript:myclick('+ i +')">' + name + '<\/a><br>'; GLog.write(side_bar_html); document.getElementById("side_bar").innerHTML = side_bar_html; } }); } } //]]> </script> </head> <body onload="load()" onunload="GUnload()"> <table border="1"> <tr><td> <div id="map" style="width: 700px; height: 500px"></div> </td> <td width="150" valign="top"><div id="side_bar"></div></td> </tr> </table> <div style="display:block;" id="message"></div> </body> </html> |