지도 마커를 초기화 할 때 마커를 배치하고 싶습니다. 이지만 infowindow의 내용은 보이지 않습니다. JSFiddle.net과 동일한 코드가 작동합니다. 그것이MAP 초기화시 기본 마커를 만들었지 만 마커가 콘텐츠를 표시하지 않습니까? 그것을 위해 무엇을 할 수 있습니까?
function initialize()
{
\t var map;
\t var myCenter = new google.maps.LatLng(18.527362399999998,73.8783206);
\t var mapProp = {
\t center:myCenter,
zoom:10,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map-canvas"),mapProp);
addMarker(myCenter, 'Center of Map', map,"gg");
}
function addMarker(latlng,title,map,info){
var marker = new google.maps.Marker({
position: latlng,
map: map,
zoom:12,
title: title,
draggable:true
});
\t var infowindow = new google.maps.InfoWindow();
//creating new infowindow
\t infowindow.close();//hide the infowindow
\t infowindow.setContent('Latitude: ');
\t infowindow.open(map,marker);
}
<html>
<body onload="initialize()" style="background-color: #EFEFEF">
<div id="mapDiv" style="display: none;">
\t \t \t <p>
\t \t \t \t <input type="text" size="60" id="mapAdd" name="address" />
\t \t \t \t <input type="button" name="getLocation" value="Get Location" onclick="closeMap();"/>
\t \t \t </p>
\t \t \t \t <input type="text" id="lat"/>
\t \t \t \t <input type="text" id="lng"/>
\t \t \t \t <div id="map-canvas"></div>
\t \t \t </div>
</body>
</html>
방금 작성한 정보 창을 닫을 필요는 없습니다. 열려있는 전화를 열 때까지 열리지 않습니다. – duncan