0

I'm trying to pass two variable to a piece of Marker code that draws the markers on the map i just don't know how to pass the variable what type must they be in order for me to achieve this heres what im trying to do:

double car = -23.363882;
double car2 = 126.044922;

position: new google.maps.LatLng(car,car2)
1
  • what problem your getting in this? Commented Oct 20, 2011 at 14:08

2 Answers 2

2

In JavaScript, variables should be declared using the var statement. I'm not sure where you got double from.

Here's how you draw a marker on a map:

var lat = -23.363882;
var lng = 126.044922;
var latLng = new google.maps.LatLng(lat, lng);
var marker = new google.maps.Marker({
    map: theMap,
    position: latLng
});

I hate to say RTFM, but the API docs do spell out the answer to your question. http://code.google.com/apis/maps/documentation/javascript/overlays.html#Markers

Sign up to request clarification or add additional context in comments.

Comments

0

car and car2 variables should be declared in the following manner : var car = -23.363882; var car2 = 126.044922;

Note that Javascript doesn't use concrete types when declaring a variable.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.