On Jun 12, 6:10 am, Dave_Tenen <[email protected]> wrote:
> Basically I would like to do this;
>
> point = new GLatLng(document.getElementById("address").value);
> map.setCenter(point, 11);
>
> I'd like the JS file to grab the address from the textbox "address"
> and make the point variable it's lat,lng.
>
> So the above code in reality would be;
>
> point = new GLatLng(-27.8391, 133.5938);
> map.setCenter(point, 11);

This is a Javascript question, not a Maps question.

document.getElementById("address").value returns a single string, say
"-27.8391,133.5938" -- that's just a collection of characters.

GLatLng() requires two floating-point numbers.

So you need to split the string at the comma into two separate
portions and then convert each portion to a float.

Look up split and parseFloat. One tutorial site is 
http://www.w3schools.com/JS/default.asp
-- there are others.

Andrew
--~--~---------~--~----~------------~-------~--~----~
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