<head>
<script type="text/javascript">
function getLocation() {
var location = document.getElementById("currentLocation");
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
location.innerHTML =
"緯度: " + position.coords.latitude + " - " +
"緯度: " + position.coords.longitude;
});
}
}
</script>
</head>
<body>
<input type="button" onclick="getLocation()" value="Click"></input>
<br/>
<label id="currentLocation"></label>
</body>
関連リンク:
HTML5 Geolocation
http://www.w3schools.com/html/html5_geolocation.asp
0 件のコメント:
コメントを投稿