Google geocode version 3

I am building one option to find the address through geocode but i am not able to copy/paste the exact code from google or may be i am doing something wrong, it is not showing the map neither the marker:

Here is the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Find Address</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<cfif IsDefined('form.findaddress')>
<cfinvoke component="#request.cfcPath#.googlegeocoder3" method="googlegeocoder3" returnvariable="geocode_answer">       
<cfinvokeargument name="address" value="#form.address#">
<cfinvokeargument name="ShowDetails" value="false">
<cfdump var="#geocode_answer#">
<cfoutput query="geocode_answer">
<script type="text/javascript">    
var geocoder;
  var map;
  var infowindow = new google.maps.InfoWindow();
  var marker;
  function initialize() {
    geocoder = new google.maps.Geocoder();
    var latlng = new google.maps.LatLng(40.730885,73.997383);
    var myOptions = {
      zoom: 8,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

  function codeLatLng() {
    var input = document.getElementById("latlng").value;
    var latlngStr = input.split(",",2);
    var lat = parseFloat(latlngStr[0]);
    var lng = parseFloat(latlngStr[1]);
    var latlng = new google.maps.LatLng(lat, lng);
    if (geocoder) {
      geocoder.geocode({'latLng': latlng}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
          if (results[1]) {
            marker = new google.maps.Marker({
                position: latlng,
                map: map
  , marker);
        } else {
          alert("Geocoder failed due to: " + status);
<body onload="initialize()">
<div id="map_canvas" style="width: 320px; height: 480px;"></div>
<table align="center" width="100%" class="border">
  <cfform action="#cgi.SCRIPT_NAME#?#cgi.QUERY_STRING#" method="post">
  <tr><td><caption>Find Latitute & Longitude of Address and Show on Map.</caption></td></tr>
  <cfif IsDefined('n')>
        <tr><td align="center" class="darkred"><cfoutput>#ToString(ToBinary(n))#</cfoutput></td></tr>
  <cftextarea name="address" value="#getAddress.address#" rows="5" class="inputstyle" cols="45"></cftextarea>
    <input type="submit" name="findaddress" value="Find Address!" class="tinyborder" onclick="codeAddress()">
LVL 16
Gurpreet Singh RandhawaCEOAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

for starters, you seem to be missing a <script> tag to load google maps script...

and i am pretty sure you should not have all your js inside of a query cfoutput.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gurpreet Singh RandhawaCEOAuthor Commented:
well i may skipped but what exactly that is i wanna include here

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.