Hi McFly- Please read the suggested posting guidelines, linked to from the top of this group. Particularly note the section about providing a link to your code online, in order to get help faster.
- pamela On Sep 13, 12:37 pm, McFly <[EMAIL PROTECTED]> wrote: > Hello All, > > I am not an extremely experienced javascript programmer. > > I do know a few things, but I am just a bit lost in my code right now, > and was hoping for a fresh eye to see what I could be missing or doing > wrong. > > I've been working on this for about 48 hours, and I just can't get it. > > I've read many online posts here and other resources as well, but it > just won't come together. > > Here is my code, so you can see what I have. I am basically just > trying to get the sidebar functioning, so the links open the markers. > > I noted all sections that apply with the side_bar with: > > //************************** SIDEBAR CODE START > ***************************************// > > & END > > SOS!!! > > <!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>My Google Maps API</title> > <script src="http://maps.google.com/maps? > file=api&v=2&key=ABQIAAAAev64njYE-ljXkntj- > t6m7hT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTSUL3R-StGr0TxJ3DF-aBM6iMpFw" > type="text/javascript"></script> > <script type="text/javascript"> > //<![CDATA[ > > var iconBlue = new GIcon(); > iconBlue.image = 'http://labs.google.com/ridefinder/images/ > mm_20_blue.png'; > iconBlue.shadow = 'http://labs.google.com/ridefinder/images/ > mm_20_shadow.png'; > iconBlue.iconSize = new GSize(12, 20); > iconBlue.shadowSize = new GSize(22, 20); > iconBlue.iconAnchor = new GPoint(6, 20); > iconBlue.infoWindowAnchor = new GPoint(5, 1); > > var iconRed = new GIcon(); > iconRed.image = 'http://labs.google.com/ridefinder/images/ > mm_20_red.png'; > iconRed.shadow = 'http://labs.google.com/ridefinder/images/ > mm_20_shadow.png'; > iconRed.iconSize = new GSize(12, 20); > iconRed.shadowSize = new GSize(22, 20); > iconRed.iconAnchor = new GPoint(6, 20); > iconRed.infoWindowAnchor = new GPoint(5, 1); > > var customIcons = []; > customIcons["restaurant"] = iconBlue; > customIcons["bar"] = iconRed; > > //************************** SIDEBAR CODE START > ***************************************// > > var side_bar_html = ""; > var gmarkers = []; > var i = 0; > > //************************** SIDEBAR CODE END > ***************************************// > > function load() { > if (GBrowserIsCompatible()) { > var map = new GMap2(document.getElementById("map")); > map.addControl(new GSmallMapControl()); > map.addControl(new GMapTypeControl()); > map.setCenter(new GLatLng(47.614495, -122.341861), 13); > > GDownloadUrl("db_2_xml_parser.php", function(data) { > var xml = GXml.parse(data); > var markers = > xml.documentElement.getElementsByTagName("marker"); > for (var i = 0; i < markers.length; i++) { > var name = markers[i].getAttribute("name"); > var address = markers[i].getAttribute("address"); > var type = markers[i].getAttribute("type"); > var point = new > GLatLng(parseFloat(markers[i].getAttribute("lat")), > > parseFloat(markers[i].getAttribute("lng"))); > var marker = createMarker(point, name, address, type); > map.addOverlay(marker); > } > }); > } > } > > function createMarker(point, name, address, type) { > var marker = new GMarker(point, customIcons[type]); > var html = "<b>" + name + "</b> <br/>" + address; > GEvent.addListener(marker, 'click', function() { > marker.openInfoWindowHtml(html); > }); > > //************************** SIDEBAR CODE START > ***************************************// > gmarkers[i] = marker; > side_bar_html += '<a href="javascript:myclick(' + i + ')">' + > name + '</a><br>'; > i++; > //************************** SIDEBAR CODE END > ***************************************// > > return marker; > > } > > //************************** SIDEBAR CODE START > ***************************************// > > function myclick(i) { > GEvent.trigger(gmarkers[i], "click"); > } > > document.getElementById("side_bar").innerHTML = side_bar_html; > > //************************** SIDEBAR CODE END > ***************************************// > > //]]> > </script> > </head> > > <body onload="load()" onunload="GUnload()"> > <div id="map" style="width: 500px; height: 300px"></div> > <div id="side_bar"></div> > </body> > </html> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
