PDA

View Full Version : Embedded direction form into google map



sparrow
02 Jan 2009, 02:39 PM
Help!!

I have managed to setup my map on google map but would like to create
google map on my own website and this script I made doesnt work as it
came up with no map? See this
http://www.pcglow.co.uk/contact.php

I am trying to use a embedded form to get direction from / to on google map
using info Window. Here is the script.....


<script src="http://maps.google.com/maps?
file=api&amp;v=2&amp;key=dddfddd"
type="text/javascript"></script>
<script type="text/javascript">
function createMarker(point,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);


});
return marker;
}


function initialize() {
if (GBrowserIsCompatible()) {
// Create and Center a Map
var map = new GMap2(document.getElementById("map_canvas"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
var point =new GLatLng(51.29005589778965, -0.7528384029865265);
map.openInfoWindowHtml(point,);
map.setCenter(point, 17);
map.setMapType(G_NORMAL_MAP);
map.enableScrollWheelZoom();
var marker = createMarker(point)
map.addOverlay(new GMarker(point));

}
}


</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<form action='http://maps.google.co.uk/maps' method="get"
target="_blank">
Enter your starting address:
<label for="mapsUkSaddr">Your address</label>
<input type="text" class="text" name="saddr" id="mapsUkSaddr" value=""
size="20" />
<input type="submit" class="submit" value="Map It" />
<input type="hidden" name="daddr" value="Farnborough, Hants" />
<input type="hidden" name="hl" value="en"/>
</form>"
<div id="map" style="width: 500px; height: 300px"></div>

Where did I go wrong with this script?

Thanks