BIG
<!DOCTYPE html>
<html>
<body>
<p>Click the button to get your coordinates.</p>
<button onclick="getLocation()">Try It</button>
<p id="demo"></p>
<script>
var x = document.getElementById("demo");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
x.innerHTML = "Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
</script>
</body>
</html>
LIST
'!!...JS-HTML' 카테고리의 다른 글
[javascript] signpad sample (0) | 2022.10.12 |
---|---|
[javascript] javascript json 문자열 파싱 샘플_001 (0) | 2022.10.07 |
[javascript] jQuery 이용 form 생성하여 값 전송하기 (0) | 2022.10.06 |
[javascript] jQuery 이용 1초 마다 class add / remove 샘플 (0) | 2022.10.05 |
[javascript] UnixTimeStamp to dateTime Sample (0) | 2022.10.05 |