I have a basic code for geocoding.

I use this code for learning.

There is only ONE button on the screen

My Questions:

1. How can I set focus on this button so it will be activated when I click Enter ?

2. is it possible to initialize the textbox with the clipboard contents when the hta is loaded ?

3. Is it possible to simulate a click on the button each time the hta is loaded ?





Here is the code

Many thanks !!!


Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Gonen title</title>

<script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAAkpclZCcw0Dd8N7urilPb8RTwi2g_12bF65p4zEDwX2jt7cD0dhQvH8snORVwA2VqfU-YMqHbC23bgg" type="text/javascript"></script>
<script src="http://www.google.com/uds/api?file=uds.js&v=1.0&key=ABQIAAAAkpclZCcw0Dd8N7urilPb8RTwi2g_12bF65p4zEDwX2jt7cD0dhQvH8snORVwA2VqfU-YMqHbC23bgg" type="text/javascript"></script>

<script src="http://www.google.com/uds/solutions/localsearch/gmlocalsearch.js" type="text/javascript"></script>
<style type="text/css">  @import url("http://www.google.com/uds/css/gsearch.css");  @import url("http://www.google.com/uds/solutions/localsearch/gmlocalsearch.css");</style>


<script type="text/javascript">
    //<![CDATA[

    var map;
    var geocoder;

    function load() {
map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(38.134557,-95.800781), 3);
geocoder = new GClientGeocoder();
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl()) ;

// bind a search control to the map, suppress result list
    }

    // addAddressToMap() is called when the geocoder returns an
    // answer.  It adds a marker to the map with an open info window
    // showing the nicely formatted version of the address and the country code.
    function addAddressToMap(response) {
      map.clearOverlays();
      if (!response || response.Status.code != 200) {
        alert("Address cannot be geocoded");
    } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
                            place.Point.coordinates[0]);
        marker = new GMarker(point);
        map.addOverlay(marker);

    // place coordinates on clipboard
        var input = String(place.Point.coordinates)
        window.clipboardData.setData('Text',input);

    // will close the window
        window.close();

        marker.openInfoWindowHtml(place.address + '<br />' + '<b>Coordinates:</b> ' + place.Point.coordinates);
      }
    }

    // showLocation() is called when you click on the Search button
    // in the form.  It geocodes the address entered into the form
    // and adds a marker to the map at that location.
    function showLocation() {

    // value from input box
    //  var address = document.forms[0].q.value;

    // value from clipboard
      var address = window.clipboardData.getData ("Text")
      geocoder.getLocations(address, addAddressToMap);
    }

   // findLocation() is used to enter the sample addresses into the form.
    function findLocation(address) {
      document.forms[0].q.value = address;
      showLocation();
    }
    //]]>
GSearch.setOnLoadCallback(load);
    </script>

<script type="text/javascript">
function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlay(curobj, subobjstr, opt_position){
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
subobj.style.display=(subobj.style.display!="block")? "block" : "none"
var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0)
var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
subobj.style.left=xpos+"px"
subobj.style.top=ypos+"px"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}
</script>


</head>

<body onload="load()" onunload="GUnload()">
<table>
<tr>
</tr>
</table>
<br />

<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
    <form action="#" onsubmit="showLocation(); return false;" name="geoForm">
        <b>Click:</b>
<input type="text" name="q" value="" size="0" />
        <input type="submit" name="find" value="Get from Clipboard and Map It" />
      <br /> </form>

    <div id="map" style="width: 100%; height: 480px"></div>
<hr size=1 align=left width=90% color=#000000 style='border: dotted;'>
</form>



</body>

</html>