On my map on http://whereschp.com/new/index.php?p=mainmap I'm not able
to click the map to add a pin.
I'm using the same code on the tutorials but for some reason it's not
working at all.
This is my first time posting in these groups so I'm not very familiar
with the layout of how this works.
Is this supposed to be like a forum or am I going to get an email when
someone replies to this?
Next time are there tags I can wrap my source code in that will
display line numbers and color/format the code accordingly?

Thank you for reading!

Here's the source code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>whereschp.com</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?
sensor=true"></script>
<script type="text/javascript" src="onload.js"></script>
<script type="text/javascript">
//<![CDATA[
var customIcons = {
        dui: {
                icon: 
'http://labs.google.com/ridefinder/images/mm_20_black.png',
                shadow: 
'http://labs.google.com/ridefinder/images/mm_20_shadow.png'
        },
        trap: {
                icon: 
'http://labs.google.com/ridefinder/images/mm_20_white.png',
                shadow: 
'http://labs.google.com/ridefinder/images/mm_20_shadow.png'
        },
        redlight: {
                icon: 'http://labs.google.com/ridefinder/images/mm_20_red.png',
                shadow: 
'http://labs.google.com/ridefinder/images/mm_20_shadow.png'
        }
};
function load() {
        var map = new google.maps.Map(document.getElementById("map"), {
                center: new google.maps.LatLng(37.441063,-122.146683),
                zoom: 13,
                mapTypeId: 'roadmap'
        });
        google.maps.event.addListener(map, 'click', function(event) {
                placeMarker(event.latLng);
        });
        var infoWindow = new google.maps.InfoWindow;
        var linkfile = <?php echo "\"genxml.php?p=".$_GET['p']."\"" ?>;
        downloadUrl(linkfile, function(data) {
                var xml = data.responseXML;
                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 google.maps.LatLng(
                                parseFloat(markers[i].getAttribute("lat")),
                                parseFloat(markers[i].getAttribute("lng")));
                        var html = "<div class=\"popup\"><b>" + name + "</b> 
<br/>" +
address +"</div>";
                        var icon = customIcons[type] || {};
                        var marker = new google.maps.Marker({
                                map: map,
                                position: point,
                                icon: icon.icon,
                                shadow: icon.shadow
                        });
                        bindInfoWindow(marker, map, infoWindow, html);
                }
        });
}

function placeMarker(location) {
  var clickedLocation = new google.maps.LatLng(location);
  var newmarker = new google.maps.Marker({
      position: location,
      map: map
  });
  map.setCenter(clickedLocation);
}

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() {}
</script>
</head>
<?php
switch ($_GET['p'])      {
        default: echo "<body>\n"; break;
        case 'mainmap': echo "<body onload=\"load()\">\n"; break;
}
?>
<div class="container">
    <div class="head">
HEADER
    </div>
    <div class="lefcol">
        <div class="leftop">newsfeedbar</div>
        <div class="lefbot">Left Bot</div>
    </div>
    <div class="center">
                <?php
        switch ($_GET['p']) {
            default: include 'home.php'; break;
            case 'home': include 'home.php'; break;
            case 'mainmap': include 'mainmap.php'; break;
        }
        ?>
    </div>
    <div class="centbot">Center Bottom</div>
    <div class="rigcol">
        <div class="rigtop">Right Top</div>
        <div class="rigbot">Right Bottom</div>
    </div>
    <div class="footer">Footer</div>
</div>

</body>
</html>

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