Please help to call a function on onclick of submit button
This is my code
function searchStart(searchControl, searcher, query) {
var content = document.getElementById('content');
var queryDiv = document.getElementById('query');
if (! queryDiv) {
var queryDiv = document.createElement('div');
queryDiv.id = 'query';
document.body.appendChild(queryDiv);
}
queryDiv.innerHTML = "postal office loc: " + query;
}
function initialize() {
var mapCanvas = document.getElementById("mapCanvas");
var resultsCanvas = document.getElementById("resultsCanvas");
var map2 = new google.maps.Map2(mapCanvas);
map2.addControl(new GLargeMapControl());
map2.addControl(new GMapTypeControl());
map2.setCenter(new google.maps.LatLng(34.431, -119.573), 13);
// Set where the results will appear
options = new Object();
options.resultList = resultsCanvas;
options.resultFormat = "multi-line1";
options.searchFormHint = "Beverly Hills, CA";
/*options.onSearchCompleteCallback = function(searcher){
alert(searcher.results + "
results");
}*/
var lsc2 = new google.elements.LocalSearch(options);
map2.addControl(lsc2, new GControlPosition(G_ANCHOR_TOP_LEFT,
new GSize(-282, -2)));
// Set a callback so that whenever a search is started we will call
searchStart
lsc2.setSearchStartingCallback(this, searchStart);
//map2.execute(opt_query?);
}
google.setOnLoadCallback(initialize);
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="mapWrapperCanvas">
<table class="mapcanvastable" style="width:801px;"
align="center" style="border:1px solid #999;">
<tr>
<td style="width:280px">
<div id="mapSearch"></div>
<div id="resultsCanvas"></div>
</td>
<td>
<script type="text/javascript">
document.getElementById(":0:buttonId").onclick = function(){
alert("Hello world!");
}
</script>
<div id="mapCanvas"></div>
</td>
</tr>
</table>
</div>
</body>
</html>
THIS DIV IS IN WHICH THE SUBMIT BUTTON COMES (<div
id="resultsCanvas"></div>)
TRIED TO CALL A FUNCTION LIKE
<script type="text/javascript">
document.getElementById(":0:buttonId").onclick = function(){
alert("Hello world!");
}
</script>
:0:buttonId ---> THIS IS THE SUBMIT BUTTON ID
BUT CANNOT GET THE ALERT.
PLEASE HELP ME
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google AJAX APIs" 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-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---