On Oct 18, 3:52 pm, sheldon <[email protected]> wrote:
> I'm not sure if it's a javascript error or what so I apologize in
> advance if this is an off topic question (I'm new to both java and
> maps API).
>
> I used a bit of google code example, fit it to my needs, and as a
> stand alone HTML page it works fine.  It shows my location using W3C
> geolocation and it plops down the markers as I would expect.
>
> Now when I take this same code and plop it into a "template" for my
> website it still works as I would expect it to as far as showing the
> map and my location, however my markers do not appear.
> It finds my xml php script fine and as far as I know it finds my
> customIcon variable but I'm not certain about that.  Can anyone take a
> look and help me figure out where I'm going wrong when I put the
> script into my 'template' ?
>
> Here is a link to the stand alone html page:
>
> http://www.weedconnect.net/maps/gmapsense.html

All I get on that page is:
"Your browser doesn't support geolocation. Are you stoned?"
And it puts me in Siberia...

If I zoom out enough I can see your markers.

I would suggest moving your downloadUrl call into your initialize
function as it depends on the map variable being initialized to add
the markers and your longer main page will call the initialize
function later (possibly after the marker data has been returned from
the server).

  -- Larry

>
> and where I'm trying to get it to appear is on the homepage of that
> domain.  If you go to the root of the domain you'll see the same map
> and no marker.  Here is a snippet of the code where I think the
> problem lies:
>
>     var customIcons = {
>       US: {
>         icon: 'http://www.weedconnect.net/maps/leaf_icon.png'
>         }
>
> };
>
>       var infoWindow = new google.maps.InfoWindow;
>
>       // Change this depending on the name of your PHP file
>       downloadUrl("maps/listings_xml.php", function(data) {
>         var xml = data.responseXML;
>         var markers =
> xml.documentElement.getElementsByTagName("marker");
>         for (var i = 0; i < markers.length; i++) {
>           var country = markers[i].getAttribute("country");
>           var name = markers[i].getAttribute("name");
>           var address = markers[i].getAttribute("address");
>           var city = markers[i].getAttribute("city");
>           var state = markers[i].getAttribute("state");
>           var zip = markers[i].getAttribute("zip");
>           var telephone = markers[i].getAttribute("telephone");
>           var point = new google.maps.LatLng(
>               parseFloat(markers[i].getAttribute("lat")),
>               parseFloat(markers[i].getAttribute("lng")));
>           var html = "<b>" + name + "</b> <br/>" + address + "<br/>" +
> city + ", " + state + " " + zip + "<br/>" + telephone;
>           var icon = customIcons[country] || {};
>           var marker = new google.maps.Marker({
>             map: map,
>             position: point,
>             icon: icon.icon
>           });
>           bindInfoWindow(marker, map, infoWindow, html);
>         }
>       });
>
>     function bindInfoWindow(marker, map, infoWindow, html) {
>       google.maps.event.addListener(marker, 'click', function() {
>         infoWindow.setContent(html);
>         infoWindow.open(map, marker);
>       });
>     }
>
>     function downloadUrl(url, callback) {
>       var request = window.ActiveXObject ?
>           new ActiveXObject('Microsoft.XMLHTTP') :
>           new XMLHttpRequest;
>
>       request.onreadystatechange = function() {
>         if (request.readyState == 4) {
>           request.onreadystatechange = doNothing;
>           callback(request, request.status);
>         }
>       };
>
>       request.open('GET', url, true);
>       request.send(null);
>     }
>
>     function doNothing() {}

-- 
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.

Reply via email to