http://apis.map.daum.net/web/sample/keywordList/
이 예제에서
각 검색결과에 따라 마우스 오버시
경도 위도값을 표현해주기 위하여
displayPlaces 함수부분에
(function(marker, title,latlng) {
daum.maps.event.addListener(marker, ‘mouseover’, function() {
displayInfowindow(marker, title,latlng);
});
daum.maps.event.addListener(marker, 'mouseout', function() {
infowindow.close();
});
daum.maps.event.addListener(marker, 'click', function() {
//infoCustom.setMap(map);
createInfoButton(latlng.getLat(),latlng.getLng());
});
itemEl.onmouseover = function () {
displayInfowindow(marker, title);
};
itemEl.onmouseout = function () {
infowindow.close();
};
})(marker, places[i].place_name,placePosition);
로 바꾸고
function displayInfowindow(marker, title,latlng) {
// var content = ‘
var content = ‘
’+
’ 경도=’+latlng.getLat()+‘위도=’+latlng.getLng()+’
infowindow.setContent(content);
infowindow.open(map, marker);
}
function createInfoButton(x,y){
document.getElementById(“addBtn”).innerHTML="<input type=‘button’ value=‘세부정보2’ id=‘detail2’"+
“onclick=‘detail(x, y)’/>”;
}
…
라는 함수기능을 추가해주었습니다. 그런데 검색결과에서 위도가 제대로 표시되지 않는 부분도 있던데 잘못 표현했기때문에 안되는건가요 아니면 예제에서 가져오는 배열에 위도가 담아지지 않아서 나오는 에러인가요..?
그리고 온클릭 이벤트시에 하단에 버튼을 생성하도록 구현했는데
버튼클릭시 alert(경도, 위도)가 뜨도록 하려했으나
정상작동되지않고 외부 html에서 작동되는거같은데… 이부분은 외그런건ㄱ아ㅛ