I have the following code that I'm using to generate a user's map (was initially showing traffic hence the traffic stuff int he code).
All I"m trying to do is add random markers via google's example code here:
Google Maps JavaScript API Example: Simple Markers
I however can't make it work.
Can anyone help me out? Beer on me via paypal if you do.
All I"m trying to do is add random markers via google's example code here:
Google Maps JavaScript API Example: Simple Markers
I however can't make it work.
Can anyone help me out? Beer on me via paypal if you do.
Code:
<!--
Copyright 2008 Google Inc.
Licensed under the Apache License, Version 2.0:
http://www.apache.org/licenses/LICENSE-2.0
-->
<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi?key=MMMMYYYYYYYYYYAAAAAAAPPPPPPIIIIIIIIIIIIKKKKKEEEEYYYYYYYYYYYY"></script>
<script>
google.load("maps", "2", {callback: initialize});
function initialize() {
// Initialize default values
var zoom = 3;
var latlng = new google.maps.LatLng(37.4419, -100.1419);
var location = "Showing default location for map.";
var map;
var trafficInfo;
var trafficOptions = {incidents:true};
// If ClientLocation was filled in by the loader, use that info instead
if (google.loader.ClientLocation) {
zoom = 12;
latlng = new google.maps.LatLng(google.loader.ClientLocation.latitude, google.loader.ClientLocation.longitude);
location = "Showing IP-based location: <b>" + getFormattedLocation() + "</b>";
}
document.getElementById("location").innerHTML = location;
var map = new google.maps.Map2(document.getElementById('map'));
map.setCenter(latlng, zoom);
map.addControl(new GLargeMapControl());
// map.addControl(new GMapTypeControl());
}
function getFormattedLocation() {
if (google.loader.ClientLocation.address.country_code == "US" &&
google.loader.ClientLocation.address.region) {
return google.loader.ClientLocation.address.city + ", "
+ google.loader.ClientLocation.address.region.toUpperCase();
} else {
return google.loader.ClientLocation.address.city + ", "
+ google.loader.ClientLocation.address.country_code;
}
}
</script>
</head>
<body style="background: #f1f1f1;">
<div style="width:500;height:350; border: 2px solid #666666;" id="map"></div>
<div id="location"></div>
</body>
</html>