I think i've narrowed down the problem to this line of code:
infowindow = new google.maps.InfoWindow({content: label});
i can input 'aptinfo' with option 2 of the XML file above and the content
shows up, but i can't do this:
infowindow = new google.maps.InfoWindow({content: label, aptinfo});
without throwing an error. i just want my label and information to
display... argh.
-Joe
On Fri, Jul 1, 2011 at 7:26 PM, Joe Youngblood <[email protected]>wrote:
> it isnt jsut HTML. anything i put in the description attribute field doesnt
> show up on the marker. I renamed the attribute to aptinfo, that didnt work.
>
> i tried to use the infowindow XML like that page suggested, and still
> nothing.
>
> maybe its in my page code?
>
> var infowindow;
> var map;
>
> function initialize() {
> var myLatlng = new google.maps.LatLng(32.802955,-96.769923);
> var myOptions = {
> zoom: 11,
> center: myLatlng,
> mapTypeId: google.maps.MapTypeId.ROADMAP
> }
> map = new google.maps.Map(document.getElementById("map_canvas"),
> myOptions);
> downloadUrl("moredata.xml", function(data) {
> var markers = data.documentElement.getElementsByTagName("marker");
> for (var i = 0; i < markers.length; i++) {
> var latlng = new
> google.maps.LatLng(parseFloat(markers[i].getAttribute("lat")),
>
> parseFloat(markers[i].getAttribute("lng")));
> var marker = createMarker(markers[i].getAttribute("label"),
> latlng);
>
> }
> });
> }
>
> function createMarker(label, latlng) {
> var marker = new google.maps.Marker({position: latlng, map: map});
> google.maps.event.addListener(marker, "click", function() {
> if (infowindow) infowindow.close();
> infowindow = new google.maps.InfoWindow({content: label});
> infowindow.open(map, marker);
> });
> return marker;
> }
>
> XML option 1:
> <?xml version="1.0" encoding="UTF-8"?>
> <markers>
> <marker lat="32.931831" lng="-96.817955" label="Marker One">
> <infowindow>Some stuff to display in the<br>First Info
> Window</infowindow>
> </marker>
> <marker lat="32.925653" lng="-96.778015" label="Marker 2">
> <infowindow>Some stuff to display in the<br>First Info
> Window</infowindow>
> </marker>
> <marker lat="32.650013" lng="-96.87962" label="Marker 3">
> <infowindow>Some stuff to display in the<br>First Info
> Window</infowindow>
> </marker>
> </markers>
>
>
> XML option 2:
> <markers>
> <marker name="Villa Piana" aptinfo="rent here" lat="32.931831"
> lng="-96.817955"/>
> <marker name="Alexan City North" aptinfo="rent here" lat="32.925653"
> lng="-96.778015"/>
> <marker name="West Virgina Park Apartments" aptinfo="rent here"
> lat="32.650013" lng="-96.87962"/>
> </markers>
>
>
> -Joe
>
> On Fri, Jul 1, 2011 at 1:18 PM, Rossko <[email protected]> wrote:
>
>> > example XML file:
>> http://gmaps-samples-v3.googlecode.com/svn/trunk/xmlparsing/moredata.xml
>>
>> Yep, its an example with no HTML content.
>> How about showing us what goes wrong for ytou, so we can see what the
>> trouble is?
>>
>> This gives some tips, even though it is a v2 example
>> http://econym.org.uk/gmap/basic3.htm
>> Note pitfalls 3 and 4
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
>>
>>
>
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.