Hi.
Try this.
Create a valid HTML form:
<form action="" onsubmit="myFunction(this); return false">
<input type="text" name="lat" value="" maxlength="12" />
<input type="text" name="lng" value="" maxlength="12" />
<input type="submit" value="Go" />
</form>
function myFunction(myForm){
// myForm is the form so you can access values like this:
var lat=parseFloat(myForm.lat.value);
var lng=parseFloat(myForm.lng.value);
// so create your markers in this function and add them to the map
}
When the form submits, the 'return false' part of the onsubmit handler
prevents the form from submitting to the server - a standard AJAX form
you could say.
If the form still submits then look for errors in myFunction(), an
error which prevents the function from completing will also prevent
the return false from being executed and that means the form will
submit (to itself as the action attribute is empty) and the page will
reload.
Martin.
On 20 Sep, 12:44, Mansoor <[email protected]> wrote:
> Hi,
>
> I have a simple form that has two input fields for latitude and
> longitude values respectively. I want to add markers on the google map
> on the onClick event of submit button with the form. I should be able
> to add as many markers as i can without refreshing or reloading the
> map. I have tried my best out over the internet but in vain.. please
> help.
>
> Regards.
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.