Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > JavaScript > Google Map
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 35574 of 36380
Post > Topic >>

Google Map

by "colleen1980@[EMAIL PROTECTED] " <colleen1980@[EMAIL PROTECTED] > May 12, 2008 at 07:16 AM

Hi: I try to follow the instruction using google map in javascript.
Script some times work fine but when i put the values in Your Address
Textbox it wont shows the directions. Other than that if i put the
city state and zip it works. Can any one please tell me what i make
mistake in the script?

Thanks.

SCRIPT

----------

<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/
>
    <title>Google Maps JavaScript API Example</title>
    <script src="http://maps.google.com/maps?
file=api&amp;v=2&amp;key=ABQIAAAAWjFPi89UG-
Rb3Who5FDkhRTvPROrRtr9Yene2irq6Hi48Jt9RRRSOu-klp9Mhib3eBbvZWu0LxSZjQ"
      type="text/javascript"></script>
    <script type="text/javascript">

    //<![CDATA[

      var map;

    function load() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(do***ent.getElementById("map"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
      }
    }
    //]]>

function buttonOnClick()
{
var fromaddress ;
var myaddress;
var query;
   // build the callers address string
   fromaddress = do***ent.getElementById("youraddress").value + ',' +
                 do***ent.getElementById("yourcity").value +',' +
                 do***ent.getElementById("yourstate").value +',' +
                 do***ent.getElementById("yourazip").value ;
   myaddress = '1521 Straight Path, Wyandanch, NY 11798';
   query = fromaddress + " to " + myaddress;
   do***ent.getElementById("query").innerHTML = query;
   var dirPanel = do***ent.getElementById("directions1")
   directions = new GDirections(map, dirPanel ); // make a direction
thing
   directions.load(query); // make the route

}

</script>
<body onload='load();' onunload="GUnload()">
<br>
<table>
  <tr>
    <td>Your Address:</td>
    <td><input type='text' id='youraddress'></td>
  </tr>
  <tr>
    <td>Your City:</td>
    <td><input type='text' id='yourcity'></td>
  </tr>
  <tr>
    <td>Your State:</td>
    <td><input type='text' size='2' id='yourstate'></td>
  </tr>
  <tr>
    <td>Your Zip Code:</td>
    <td><input type='text' size='5' id='yourazip'></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type='button' value='Display Route'
onclick='buttonOnClick();'></td>
  </tr>
</table>
<center><a href="index.html">Back to Home Page</a></center>
<br>
<center>
<div id="map" style="width: 500px; height: 300px" ></div>
<div id="query" > &nbsp; </div>
</center>
<div id="directions1" style="width: 500px; height: 300px" ></div>
</body>
</html>
 




 3 Posts in Topic:
Google Map
"colleen1980@[EMAIL   2008-05-12 07:16:47 
Re: Google Map
"McKirahan" <  2008-05-13 07:00:16 
Re: Google Map
Thomas 'PointedEars' Lahn  2008-05-13 23:08:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 23:26:21 CDT 2008.