Insert Google Map locator in Web site

I have created a very basic web site and would like to create one page that will display a Google Earth map and somehow allow the user to enter GPS coordinates and then have the map go to that location. I have been led to believe that it's meant to be easy to do this but I don't know enough about HTML and Java Script to do it.

Below is some code that creates a page with Google maps. And I've found some code that is supposed to do the lookup I want, but I don't know how to marry the two together. Can anyone help me or is this a big ask?

The following code does the lookup
if (!window.geocodeLocation) {
  window.geocodeLocation = 'City name, country, latitude and longitude, etc';

window.geocodeLocation = prompt('Enter a location', window.geocodeLocation);
var geocoder = new google.maps.ClientGeocoder();
geocoder.getLatLng(window.geocodeLocation, function(point) {
  if (point) {
    var lookAt = ge.createLookAt('');
    lookAt.set(, point.lng(), 10, ge.ALTITUDE_RELATIVE_TO_GROUND,
               0, 60, 20000);

The following code creates the map in a web page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
  <meta name="description" content="Locate & track"/>
  <meta name="Keywords" content="Track" />    
  <link href="StyleSheet.css"rel="stylesheet" type="text/css" />
   <script src=""  
   <script type="text/javascript">
     var ge;
     google.load("earth", "1");

     function init() {'map3d', initCB, failureCB);

     function initCB(instance) {
       ge = instance;

     function failureCB(errorCode) {

   <div id="map3d" style="height: 500px; width: 926px;"></div>

Who is Participating?
Rob4077Author Commented:
PS, I would prefer not to use a pop up to ask the location but rather just have an input box of some sort. Is that possible?
Rob4077Author Commented:
Hi denissie,
Thanks for the link. It led me to the code that I needed. Appreciate your help 
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.