fs-danaus
2022-08-05 4a551fc73bd4c86f43aa68c0aab8d1dbeae46836
提交 | 用户 | age
a6a76f 1 <%@ page language="java" contentType="text/html; charset=UTF-8"
F 2     pageEncoding="UTF-8"%>
4a551f 3 <!DOCTYPE html >
a6a76f 4
F 5 <html>
6 <head>
7 </head>
8
9 <body>
10 <p>position:</p>
11 <div id="location"></div>
12 <script>
13 window.onload=getLocation;
14 var div=document.getElementById("location");
15 function getLocation()
16   {
17   if (navigator.geolocation)
18     {
19     navigator.geolocation.getCurrentPosition(showPosition);
20     }
21   else{div.innerHTML="Geolocation is not supported by this browser.";}
22   }
23 function showPosition(position)
24   {
25   div.innerHTML="Latitude: " + position.coords.latitude + 
26   "<br />Longitude: " + position.coords.longitude;    
27   }
28 </script>
29 </body>
30
31 </html>