-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.html
More file actions
40 lines (35 loc) · 979 Bytes
/
map.html
File metadata and controls
40 lines (35 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html>
<head>
<title>map_demo</title>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyD-CuPOshEqRJDYHWAO1wAZyDHFCCKiKcQ & callback=initMap"
type="text/javascript"></script>
<style type="text/css">
#map1{
width: 400px;
height: 400px;
}
</style>
<script type="text/javascript">
x=navigator.geolocation;
x.getCurrentPosition(success , failure);
function success(position)
{
var mylat = position.coords.latitude;
var mylong = position.coords.longitude;
var coords = new google.maps.LatLng(mylat , mylong);
var mapOptions ={
zoom:20,
center: coords,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map1"),mapOptions);
var marker = new google.maps.Marker({map:map, position:coords});
}
function failure(){document.write("failed");}
</script>
</head>
<body>
<div id="map1"></div>
</body>
</html>