google map

Hi ,
i am surprised that my last question disappeared.. but again my question is about the google map issue of taking the user from his position to another one through predefined lattitude and longitude:this is my JS Code:

initialize();
calcRoute();

var directionsDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
var haight = new google.maps.LatLng(37.7699298, -122.4469157);
var oceanBeach = new google.maps.LatLng(37.7683909618184, -122.51089453697205);

function initialize() {
directionsDisplay = new google.maps.DirectionsRenderer();
var mapoptions = {
zoom: 14,
center: haight
};

map = new google.maps.Map(document.getElementById("startScreen_map"), mapoptions);
//map = new google.maps.Map($("[name=startScreen_map]")[0], mapoptions);
directionsDisplay.setMap(map);

}

function calcRoute() {
alert("1");
// var selectedMode = document.getElementById("startScreen_map").value;
var selectedMode =$("[name=startScreen_map]")[0].value;
alert("2");
alert(selectedMode);

var request = {
origin: haight,
destination: oceanBeach,
// Note that Javascript allows us to access the constant
// using square brackets and a string value as its
// "property."
travelMode: google.maps.TravelMode[selectedMode]
};

directionsService.route(request, function(response, status) {
if (status == 'OK') {
directionsDisplay.setDirections(response);

}

});
}

The line :
var selectedMode = document.getElementById("startScreen_map").value;
OR
var selectedMode =$("[name=startScreen_map]")[0].value;

do not work

Help please i am stucked since so long
1 person has
this question
+1
Reply