This what I do. Hope it helps:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script
src="http://maps.google.com/maps?file=api&v=2.x&key=<cfoutput>#request.gmapkey#</cfoutput>"
type="text/javascript"></script>
<script type="text/javascript">
var map = null;
var geocoder = null;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(40.78704, -73.965797), 13);
map.setUIToDefault()
geocoder = new GClientGeocoder();
}
}
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(address);
}
}
);
}
}
</script>
</head>
<body
onload="initialize();showAddress(document.getElementById('geo').address.value);
return false" onunload="GUnload()">
<cftry>
<form id="geo" action="#" onsubmit="showAddress(this.address.value);
return false">
<p>
<cfparam name="url.address" default="414 East 88th Street, New York">
<input type="hidden" size="50" name="address"
value="<cfoutput>#listfirst(url.address)#, New York</cfoutput>" />
<!---
<input type="submit" value="Show Map" />
--->
</p>
<div id="map_canvas" style="width: 400px; height: 500px"></div>
</form>
<cfcatch></cfcatch>
</cftry>
</body>
</html>
--
Ryan
On Sat, May 30, 2009 at 7:50 AM, Jenny Gavin-Wear <
[email protected]> wrote:
>
> Hi Ryan,
>
> I looked at the page again in firefox using the Javascript error console
>
> <script
> src="
> http://maps.google.com/maps?file=api&v=2&key=#session.GoogleKey
> #"
> type="text/javascript"></script>
> <script type="text/javascript">
> //<![CDATA[
> function load() {
> if (GBrowserIsCompatible()) {
> var map = new GMap2(document.getElementById("map"));
> map.setCenter(new GLatLng(#dLatitude#, #dLongitude#), 14);
> map.addControl(new GLargeMapControl());
> map.centerAndZoom(new GPoint(#dLatitude#, #dLongitude#), 3);
> var point = new GPoint(#dLatitude#, #dLongitude#);
> var marker = new GMarker(point);
> map.addOverlay(marker);
> }
> }
> //]]>
> </script>
>
> The line:
> map.centerAndZoom(new GPoint(#dLatitude#, #dLongitude#), 3);
>
> gives the error:
> map.centerAndZoom is not a function
>
> I removed this line assuming if it was bad the script would stop processing
> at this point, but still no marker.
>
> Jenny
>
>
>
>
>
> -----Original Message-----
> From: Ryan Letulle [mailto:[email protected]]
> Sent: 28 May 2009 14:06
> To: cf-talk
> Subject: SPAM-MEDIUM Re: IUM Re: Google Map API
>
>
>
> I assume you are not getting any javascript errors?
> --
> Ryan
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323004
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4