내 앱을 찾고 있습니다. 데이터로 파일을 업로드 한 다음 여러 마커가있는 Google지도 파일의 모든 데이터를 표시해야합니다. 엑셀 및 마커를 표시하는 데 사용 (I 사용자가 데이터 파일을 제출하려는)에서자바 스크립트를 사용하여 excel (xlsx) 파일에서 업로드 한 Google지도의 마커
<script>
function initialize() {
var mapDiv = document.getElementById('mymap');
var mapOptions = {
center: new google.maps.LatLng (-33.865143, 151.209900),
zoom: 12,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(mapDiv, mapOptions);
var locations = [];
locations.push ({name:"Bondi Beach", latlng: new google.maps.LatLng(-33.890542, 151.274856)});
locations.push ({name:"Coogee Beach", latlng: new google.maps.LatLng(-33.923036, 151.259052)});
locations.push ({name:"Cronulla Beach", latlng: new google.maps.LatLng(-34.028249, 151.157507)});
locations.push ({name:"Manly Beach", latlng: new google.maps.LatLng(-33.80010128657071, 151.28747820854187)});
for (var i = 0; i < locations.length; i++) {
var marker = new google.maps.Marker({position: locations[i].latlng, map:map, title:locations[i].name});
}
}
window.onload = initialize;
</script>
하지만 어떻게 업로드 할 수있는 데이터 : 이미 두 번째 부분에 대한 해결책을 발견 (다중 구글지도에 마커를 표시)?
나는 완전히 프로그래밍에 익숙하므로 어떤 도움을 주시면 감사하겠습니다 :)
브라우저에서이 코드를 실행할 때 오류가 발생합니다. "잡히지 않은 TypeError : null의 addEventListener '속성을 읽을 수 없으며 파일이로드되지 않습니다. 하지만 여기에 파일을로드하면 샘플에서 모든 것이 정상입니다. 문제가 될 수있는 곳은 어디입니까? 어쩌면 당신은 당신의 샘플이 내 코드로 어떻게 보이고 작동하는지 알아낼 수 있을까요? – Jaras
@Jaras,' "Uncaught TypeError : null '의 addEventListener'속성을 읽을 수 없습니다. 'document.getElementById ("excel ")'null'을 반환합니다. 이는 아마도'excel' id를 가진 입력 요소가 없기 때문일 것입니다. – Ozan