【发布时间】:2026-01-13 12:15:01
【问题描述】:
我在 codeigniter 中使用 maps.googleapis.com/maps/api 在用户键入 zip 地址时显示自动完成位置。我有两个输入字段,第一个用户将选择国家,在第二个字段中,他将输入他的邮政编码,并从谷歌自动完成中选择他的地址。
var directionsService = new google.maps.DirectionsService();
google.maps.event.addDomListener(window, 'load', function () {
new google.maps.places.SearchBox(document.getElementById('zip'));
directionsDisplay = new google.maps.DirectionsRenderer({ 'draggable': true });
});
工作正常,但现在我只想显示选定国家/地区的邮政编码。表示如果用户选择澳大利亚作为国家并输入 zip (如 2127),则 google api 应显示澳大利亚的地址,地址中包含 2127
【问题讨论】:
标签: javascript google-maps google-maps-api-3