묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
외부페이지에서 Google Map jquery 에러 해결방법 문의
2016.02.06 00:12
외부페이지에서 Google Map 를 넣으면 에러가 발생합니다.
jquery 부분 문제로 에상됩니다.
조치 가능한 방법이 있을까요?
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var geocoder;
var map;
function initialize() {
geocoder = new google.maps.Geocoder();
var myOptions = {
zoom: 17,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var address = '경기도 수원시 팔달구';
geocoder.geocode({'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
</script>
<div id="map_canvas" style="width:100%; height:400px; border:1px #dbdbdb solid;"></div>
<script language="javascript">initialize();</script>
태그 연관 글
- [2018/08/10] 묻고답하기 이 소스를 이용하여 db연동 하는 소스 문의 *1
window.onload = function() { };
window.addEventListener('DOMContentLoaded', function() { });
혹은 jQuery(function(){ });
셋중 하나 골라서 묶어보세요.