Я использую html-форму для получения входов из 3 почтовых индексов (PortZip, ImporterZip, ExporterZip).Код путевых точек в Google maps
<form>
Calculation of OUT OF ROUTE DISTANCE.<br>
Enter 5 digit VALID US ZipCodes<br><br>
Port ZipCode:<br>
<input type="text" id="PortZip" value="31402">
<br><br>
Importer ZipCode:<br>
<input type="text" id="ImporterZip" value="30308">
<br><br>
Exporter ZipCode:<br>
<input type="text" id="ExporterZip" value="30901">
<br><br>
<input type="button" value="Calculate" onclick="calcRoute()" />
</form>
Я хочу построить путь от PortZip до PortZip через ExporterZip. Код, указанный ниже:
function calcRoute() {
var start = document.getElementById('PortZip').value;
var end = document.getElementById('ImporterZip').value;
var waypts = document.getElementById('ExporterZip').value;
var request = {
origin:start,
destination:end,
waypoints:waypts,
optimizeWaypoints: true,
travelMode: google.maps.TravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}
Правильно ли сформулирована топовая точка? Этот код не приводит к каким-либо результатам. Если я запускаю код без waypoints:waypts
, он работает. Что случилось с моим кодом?
Могу ли я узнать, почему мой вопрос вниз проголосовали? Кто-то ответил правильно, что означает, что мой вопрос ясен и действителен. Теги: @geocodezip – Karvy1