but how i assign element of array into option to let user choose? there must be an interface to allow user choose right? Any suggestion?
On Apr 27, 4:58 am, Esa <[email protected]> wrote: > The first one probably works > > <select id="mode" style="width:70px"> > <option value="WALKING">Walking</option> > <option value="DRIVING">Driving</option> > </select> > > but that is just good luck because those happen to be string values of > constants > > google.maps.TravelMode.WALKING and > google.maps.TravelMode.DRIVING > > Put those constants in an array and let the select element choose from > the array > > var modeArray = []; > modeArray[0] = google.maps.TravelMode.WALKING; > modeArray[0] = google.maps.TravelMode.DRIVING; > > var selectedMode = > modeArray[document.getElementById("mode").selectedIndex]; > > Don't set values of select element at all. As Jeff said, they are not > very useful. Some browsers return a selected value but not all. That > is because of different 'multiple' attribute handling. It is better to > keep the values in a separate array. -- 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.
