Showing
1 changed file
with
66 additions
and
0 deletions
googlemaps.html
0 → 100644
| 1 | +<!DOCTYPE html> | ||
| 2 | +<html> | ||
| 3 | +<head> | ||
| 4 | + <body> | ||
| 5 | + <form> | ||
| 6 | + <div>구 입력 : <br/><input type="text" name="id" value=""></div> | ||
| 7 | + <div>도로명: <br/><input type="password" name="pwd" value=""></div> | ||
| 8 | +</form> | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +<script | ||
| 12 | +src="http://maps.googleapis.com/maps/api/js"> | ||
| 13 | +</body> | ||
| 14 | +</script> | ||
| 15 | + | ||
| 16 | +<script> | ||
| 17 | +var map; | ||
| 18 | +var Seoul = new google.maps.LatLng(37.551920, 126.994615); | ||
| 19 | + | ||
| 20 | +// Add a Home control that returns the user to Suwon | ||
| 21 | +function HomeControl(controlDiv, map) { | ||
| 22 | + controlDiv.style.padding = '5px'; | ||
| 23 | + var controlUI = document.createElement('div'); | ||
| 24 | + controlUI.style.backgroundColor = 'yellow'; | ||
| 25 | + controlUI.style.border='1px solid'; | ||
| 26 | + controlUI.style.cursor = 'pointer'; | ||
| 27 | + controlUI.style.textAlign = 'center'; | ||
| 28 | + controlUI.title = 'Set map to Seoul'; | ||
| 29 | + controlDiv.appendChild(controlUI); | ||
| 30 | + var controlText = document.createElement('div'); | ||
| 31 | + controlText.style.fontFamily='Arial,sans-serif'; | ||
| 32 | + controlText.style.fontSize='12px'; | ||
| 33 | + controlText.style.paddingLeft = '4px'; | ||
| 34 | + controlText.style.paddingRight = '4px'; | ||
| 35 | + controlText.innerHTML = '<b>Home<b>' | ||
| 36 | + controlUI.appendChild(controlText); | ||
| 37 | + | ||
| 38 | + // Setup click-event listener: simply set the map to Suwon | ||
| 39 | + google.maps.event.addDomListener(controlUI, 'click', function() { | ||
| 40 | + map.setCenter(Seoul, 37.551920, 127.994615) | ||
| 41 | + }); | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +function initialize() { | ||
| 45 | + var mapDiv = document.getElementById('googleMap'); | ||
| 46 | + var myOptions = { | ||
| 47 | + zoom: 12, | ||
| 48 | + center: Seoul, | ||
| 49 | + mapTypeId: google.maps.MapTypeId.ROADMAP | ||
| 50 | + } | ||
| 51 | + map = new google.maps.Map(mapDiv, myOptions); | ||
| 52 | + // Create a DIV to hold the control and call HomeControl() | ||
| 53 | + var homeControlDiv = document.createElement('div'); | ||
| 54 | + var homeControl = new HomeControl(homeControlDiv, map); | ||
| 55 | +// homeControlDiv.index = 1; | ||
| 56 | + map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv); | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +google.maps.event.addDomListener(window, 'load', initialize); | ||
| 60 | +</script> | ||
| 61 | +</head> | ||
| 62 | + | ||
| 63 | +<body> | ||
| 64 | +<div id="googleMap" style="width:700px;height:500px;"></div> | ||
| 65 | +</body> | ||
| 66 | +</html> |
-
Please register or login to post a comment