<select id="mode" style="width:70px">
<option value="WALKING">Walking</option>
<option value="DRIVING">Driving</option>
</select>
OR
<select id="mode" style="width:70px">
<option value="G_TRAVEL_MODE_WALKING">Walking</option>
<option value="G_TRAVEL_MODE_DRIVING">Driving</option>
</select>
Both i tried also cannot. What i want is something like the link
below.
http://code.google.com/apis/maps/documentation/javascript/examples/directions-travel-modes.html
G_TRAVEL_MODE_DRIVING I think can work in API3 because It can work
well by having the code below:
function setDirections(fromAddress, toAddress, locale) {
//var selectedMode =
document.getElementById("mode").value;
gdir.load("from: " + fromAddress + " to: " +
toAddress,
{"locale" : locale,
travelMode:G_TRAVEL_MODE_WALKING});
}
However when I come to options, It totally driving me crazy.
I tried on
document.getElementById("mode").selectedIndex.value
AND
var selectedIndex =
document.getElementById("mode").selectedIndex;
var selectedMode = document.getElementById("mode").options;
gdir.load("from: " + fromAddress + " to: " + toAddress,
{"locale" : locale,
travelMode:selectedMode[selectedIndex].values});
}
All also failed... Help please. And which script elements is appearing
to be using different keys?
On Apr 26, 12:33 pm, JKurtock <[email protected]> wrote:
> What is the "value" of a SELECT element? (you probably want something
> like ...("mode").options[....("mode").selectedIndex].value).
>
> Are you trying to use version 3 of the API? You have three different
> script elements loading a maps API, two of which appear to be using
> different keys. Left over from an old version?
>
> You appear to populate the SELECT box with values like
> G_TRAVEL_MODE_DRIVING . I think that's a version 2 constant; does it
> work in version 3?
>
> - Jeff
>
> On Apr 26, 6:21 am, summerap <[email protected]> wrote:
>
>
>
>
>
>
>
> >www.flinote.com/nam/localSearch.html
>
> > Can somebody check for me?
> > It is not able to set the travel mode.
>
> > function setDirections(fromAddress, toAddress, locale) {
> > var selectedMode = document.getElementById("mode").value;
>
> > gdir.load("from: " + fromAddress + " to: " + toAddress,
> > {"locale" : locale, travelMode:selectedMode});
> > }
>
> > Is it something wrong with this function?
--
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.