Hi,

     I am learning, how to work with GDirections. in below, when i am
giving location names directly this script is working but if i give
variables thorugh form its not working.
Can you please explain why it is not working.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xmlns:v="urn:schemas-
microsoft-com:vml">
<head>
<script src="http://maps.google.com/maps?
file=api&amp;v=2.89&amp;key=ABQIAAAACxQD09IM1Iei7ziTkSG-
dxQnYJ5ZIH7mNtEdS86qlykSLZIsmhSW1-CHggNW69fDyvqkg6OoSCC2PQ" type="text/
javascript"></script>
<script type='text/javascript' language='javascript'>
   var map;
   var panel;
   var dir;
   function initialize()
         {
            map = new GMap2(document.getElementById("map_canvas"));
            panel = document.getElementById("my_textual_div");
            map.setCenter(new GLatLng(8.506, 76.951241), 15);
            direction();
          }
   function direction()
         {
            startlocation=document.getElementById("startplace").value;
            endlocation=document.getElementById("endplace").value;
            dir = new GDirections(map, panel);
            dir.load(startlocation+"to" +endlocation);
          }
</script>
  </head>
  <body onLoad="initialize()" onunload="GUnload()">
    <table>
    <tr>
     <td>
    <div id='map_canvas' style='width: 500px; height: 500px'></div>
     </td>
     <td>
    <div id ='my_textual_div' style='width: 500px; height: 500px'></
div>
     </td>
    </tr>

<form>
startlocation:<input type="text" id="startplace" value="hyderabad"/>
endlocation:<input type="text" id="endplace" value="trivandrum"/>
<input type="button"  value="go" onclick="direction()"/>
</form>
  </body>
</html>


thanks in advabce,

sincerely,
sravan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to