On Jul 12, 6:09 am, Marvin Divo <[email protected]> wrote: > There is a link to the example > webpage:http://id241076.appspot.com/marker_from_dropdown_list/
As Rossko said, not a maps question, a javascript/dhtml question. Mike Williams has a sample with a dropdown menu in his v2 tutorial: The Basics - Part 15 Lots of sidebar entries http://econym.org.uk/gmap/basic15.htm using an attribute: http://www.geocodezip.com/marker_from_dropdown_listA.html using the text of the option: http://www.geocodezip.com/marker_from_dropdown_listB.html -- Larry > > On Jul 12, 3:42 pm, Marvin Divo <[email protected]> wrote: > > > > > 1. Thanks Marx but it will not work in my scenario. You hardcoded > > coordinates/labels in javascript... > > > <script type="text/javascript"> > > var locations = {}; > > locations['Location 1'] = new > > google.maps.LatLng(56.96073070463192, 24.078392486572266); > > locations['Location 2'] = new > > google.maps.LatLng(59.96073070463192, 27.078392486572266); > > > but the content of the dropdown list is generated dynamically by the > > server side script. > > > <option value="None">-</option> > > <option value="56.9607307 24.0783924">Location 1</option> > > <option value="59.9607307 28.0783924">Location 2</option> > > > 2. So... the Question is still open: > > > I want to make title of the marker dynamic too. I'm not very good > > in javascript... Any idea how to get 'Location 1' or 'Location 2' to > > the javascript variable? > > var markerTitle = document.getElementById("location").??????? > > > <select onchange="MarkerFromDDList()" id="location"> > > <option value="None">-</option> > > <option value="56.9607307 24.0783924">Location 1</option> > > <option value="59.9607307 28.0783924">Location 2</option> > > </select> > > > On Jul 12, 2:52 pm, Marx Zeng <[email protected]> wrote: > > > > You can try it. > > > <skiped...> > > > On 7月12日, 下午4時11分, Marvin Divo <[email protected]> wrote: > > > > > 1. Thanks Rossko, feeding LatLng two numbers helped... > > > > > var location = document.getElementById("location").value; > > > > var lat=location.substr(0,10); > > > > var lng=location.substr(11); > > > > var myLatlng = new google.maps.LatLng(lat, lng); > > > > > <...> > > > > > <select onchange="MarkerFromDDList()" id="location"> > > > > <option value="None">-</option> > > > > <option value="56.9607307 24.0783924">Location 1</option> > > > > <option value="59.9607307 28.0783924">Location 2</option> > > > > </select> > > > > > 2. I want to make title of the marker dynamic too. I'm not very good > > > > in javascript... Any idea how to get 'Location 1' or 'Location 2' to > > > > the javascript variable? > > > > > var markerTitle = document.getElementById("location").??????? > > > > > Thanks. > > > > > On Jul 10, 11:43 am, Rossko <[email protected]> wrote: > > > > > > > var myLatlng = new google.maps.LatLng(location); > > > > > > Try feeding LatLng two numbers, instead of one string of digits with > > > > > spaces and commas in it. > > > > > > > <option value="56.96073070463192, ... > > > > > > You can probaby lose about 10 decimal places off of your numbers, that > > > > > one is defined to within a nanometre. Six places should do for most > > > > > real mapping applications.- Hide quoted text - > > - Show quoted text - -- 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.
