Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:07:48+00:00 2026-06-09T06:07:48+00:00

I tried to ‘imitate’ the code from this map: https://google-developers.appspot.com/maps/documentation/javascript/examples/geocoding-simple only changing Syney to

  • 0

I tried to ‘imitate’ the code from this map:

https://google-developers.appspot.com/maps/documentation/javascript/examples/geocoding-simple

only changing Syney to Porto Alegre (in the form value and the coordinates as well). But something went wrong because the map-canvas isn’t showing on the screen. I checked the code and didn’t find any typo or syntax mistake.

I hope that someone can help. Actually I’m more used with Fusion Tables than Google Maps API.

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>GEOCODER</title>
<link href="/maps/documentation/javascript/examples/default.css" rel="stylesheet">
<script src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script>

var geocoder;
var map;
function initialize() {
   geocoder = new google.maps.Geocoder();
   var latlng = new google.maps.LatLng(-30.027704, -51,228735);
   var myOptions = {
      zoom: 8,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
   }
   map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
}

function codeAddress() {
   var address = document.getElementById("address").value;
   geocoder.geocode( { 'address': address}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
         map.setCenter(results[0].geometry.location);
         var marker = new google.maps.Marker({
            map: map,
            position: results[0].geometry.location
         });
      } else {
        alert("Geocode was not successful for the following reason: " + status);
      }
   );
  }
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width: 320px; height: 480px;"></div>
<div>
   <input id="address" type="textbox" value="Porto Alegre, Brasil">
   <input type="button" value="Encode" onclick="codeAddress()">
</div>
</body>
</html>    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:07:49+00:00Added an answer on June 9, 2026 at 6:07 am

    You may have swapped two lines, causing a syntax error. If you would check your JavaScript console, you would see the error message. You really should do that when JS doesn’t do what you expect it to do (or, for that matter, pretty much always, just to make sure there aren’t any unexpected mistakes).

    Where you have this:

          }
       );
      }
    }
    </script>
    

    You want this:

          }
       }
      );
    }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Tried this: $('.link').click(function(e) { $.getScript('http://www.google.com/uds/api?file=uds.js&amp;v=1.0', function() { $('body').append('<p>GOOGLE API (UDS) is loaded</p>'); }); return
Tried to map it from Preferences -> Settings -> Keyboard, but the key combo
Tried searching for this but my google-fu is lacking today. So I have 2
Tried this : myStructs = from MyObject s in MyObjects join c in Categories
tried uncommenting pam_limits.so from the pam.d directory but no luck. Basic PAM seems to
Tried to search for this online and didn't get very far, so I'm asking
Tried following the instructions here: How to use Google app engine with my own
Tried examples from 'php.net' but don't understand what's the problem. Any suggestions? <?php $_SESSION['test']
Tried this: int idx4 = ppt.addMovie(new File(Animation.avi).getCanonicalPath(), MovieShape.MOVIE_AVI); MovieShape pict4 = new MovieShape(idx4, idx4);
Tried to configure Spring for tests with hibernate and transactions. Getting bean from app

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.