Thanks,
and apologies for posting code and its relevance to this forum.
Managed to get it working though. Everything was fine with your
suggestion Andrew, except
walkingDriving.travelMode=eval(document.getElementById
("travelMode").value);
which I changed to...
travelMode=eval(document.getElementById
("travelMode").value);
No need for the walkingDriving variable.
Posting code again I know, but thought this would help other people
wanting to implement something like this
Many thanks
On Jul 3, 2:01 pm, Andrew Leach <[email protected]> wrote:
> On Jul 3, 1:36 pm, Lee <[email protected]> wrote:
>
>
>
> > Help will be so appreciated
>
> Please don't post code. Please don't do it twice!
>
> I suggest
>
> <select id="travelMode" name="travelMode">
> <option value="G_TRAVEL_MODE_DRIVING" selected>By Car</option>
> <option value="G_TRAVEL_MODE_WALKING">Walking</option>
> </select>
>
> then change this
>
> if(document.form.travelMode.selectedIndex == 0){
> walkingDriving.travelMode=G_TRAVEL_MODE_WALKING;}
>
> into
>
> walkingDriving.travelMode=eval(document.getElementById
> ("travelMode").value);
>
> Note the use of eval() to evaluate the string it's given and get the
> real value. You may still have problems because using field-names as
> properties of forms (like "this.from.value") isn't standard
> Javascript. Using document.getElementById() is.
>
> However: Rossko is right and this is NOT a maps question. It's a DHTML
> question about how to pass values from <select> elements into
> Javascript code.
>
> 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
-~----------~----~----~----~------~----~------~--~---