<script type="text/javascript"> var point_name ="대진계측기"; var point_address ="서울특별시 구로구 구로중앙로 198 17동 131호"; </script> <div id="map_canvas" style="width:998px; height:600px; margin:0px auto; border:1px solid #CCC;"></div> <script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.1&sensor=true"></script> <script type="text/javascript"> var geocoder; var map; function initialize(point_name,point_address) { geocoder = new google.maps.Geocoder(); xy=Array(); geocoder.geocode( { 'address': point_address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { for(var pp in results[0].geometry.location){if(typeof results[0].geometry.location[pp]=='number'){xy.push(results[0].geometry.location[pp]);}} var latlng = new google.maps.LatLng(xy[0],xy[1]); var myOptions = { zoom: 16, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: true, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU, position: google.maps.ControlPosition.TOP_LEFT }, navigationControl: true, navigationControlOptions: { style: google.maps.NavigationControlStyle.SMALL, position: google.maps.ControlPosition.TOP_RIGHT } } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var marker = new google.maps.Marker({position:latlng, map:map, title:point_name, animation:google.maps.Animation.BOUNCE}); } else{alert("유효하지 않는 주소 입니다" );} }); } window.onLoad=initialize(point_name,point_address); </script> |