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

  • SEARCH
  • Home
  • 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 6763155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:26:33+00:00 2026-05-26T14:26:33+00:00

When you click ‘Find Me’ button, it finds your location, but the problem is

  • 0

When you click ‘Find Me’ button, it finds your location, but the problem is with the geocoding part.

It should show your location’s address inside the “myaddress” div. But it gives a error that I didn’t understand.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">
function initialize() {
    var latlng = new google.maps.LatLng(0, 0);
    var myOptions = {
      zoom: 1,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("sbmr"),
        myOptions);


}

/////////////////////////////////////////////////////////////////////////////

var initialLocation;
var siberia = new google.maps.LatLng(60, 105);
var browserSupportFlag =  new Boolean();
var myposition;
var geocoder;

function geocode() {

      var myOptions = {
        zoom: 6,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      };

      var map = new google.maps.Map(document.getElementById("sbmr"), myOptions);

  // Try W3C Geolocation (Preferred)
  if(navigator.geolocation) {
    browserSupportFlag = true;
    navigator.geolocation.getCurrentPosition(function(position) {
      initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);


      /////////////////PROBLEM IS WITH THIS PART///////////////////
        var latlng = new google.maps.LatLng(initialLocation);
        geocoder = new google.maps.Geocoder();
        geocoder.geocode(latlng, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
            if (results[1])
            document.getElementById("myaddress").innerHTML = 'results[1].formatted_address'
            }
          else {
            alert("Geocoder failed due to: " + status);
          }
          });
      //////////////////////////////////////////////////
      var marker = new google.maps.Marker({
                  position: initialLocation, 
                  map: map, 
                  animation: google.maps.Animation.BOUNCE,
                  title:"You're here."
                  });

      map.setCenter(initialLocation);

      map.setZoom(15);

      //W3C olursa yapilanlar bitis
    }, function() {
      handleNoGeolocation(browserSupportFlag);
    });
  }  
}//geocodefinish
</script>

<style type="text/css">
<!--
#sbmr {
    position:absolute;
    left:62px;
    top:39px;
    width:1098px;
    height:649px;
    z-index:1;
}
#myaddress {
    position:absolute;
    left:1185px;
    top:219px;
    width:286px;
    height:318px;
    z-index:2;
}
#apDiv1 {
    position:absolute;
    left:1189px;
    top:70px;
    width:264px;
    height:117px;
    z-index:3;
}
-->
</style>
</head>

<body onload="initialize()">



<div id="sbmr"></div>
<div id="myaddress">
<h2>My address:</h2>
<br />
</div>
<div id="apDiv1">
  <label>
    <input type="submit" name="button" id="button" value="Find Me" onclick="geocode()" />
  </label>
</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-05-26T14:26:34+00:00Added an answer on May 26, 2026 at 2:26 pm

    Geocoder encodes a string address into a LatLng object. instead of passing an object with the address you are passing a latlng object, which is wrong.

    Change this:

    geocoder.geocode(latlng, function(results, status) {...
    

    with this:

    geocoder.geocode({address: "type your address here"}, function(results, status) ...
    

    UPDATE:
    if you are looking to do reverse geocoding (get address from latlng) checkout this link:
    http://code.google.com/apis/maps/documentation/javascript/services.html#ReverseGeocoding

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I click on items in my listbox and then hit a submit button, but
.bind('click',function(){ window.open($(this).find('.pc_more').html()); }); }); is there something in this part of the code that
On click of a button I am changing window.location.href , i.e. I am adding
Click Rate - that should pop up a normal boxy dialog, but styles aren't
User click on a link button and it will direct them to a url
When click a button,I want to popup a view form bottom,like this! Any help
When i click on done button which has code UIBarButtonItem * button = [[[UIBarButtonItem
I have to click on done button to dismiss modalview programmatically. I think UIButton
On click of certain listview items, I need to show sub item under the
I click on a button (or any object where I can write Action Script)

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.