mirror of
https://github.com/Hizenberg469/BPIT-ATTENDANCE.git
synced 2026-04-19 17:52:25 +03:00
50 lines
808 B
HTML
50 lines
808 B
HTML
<?php
|
|
|
|
|
|
|
|
|
|
$dochtml = new DOMDocument();
|
|
$dochtml->loadHTMLFile("index.php.html");
|
|
|
|
|
|
$div = $dochtml->getElementById('div2')->nodeValue;
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<body>
|
|
<div>
|
|
<h1>HTML Geolocation</h1>
|
|
<p>Click the button to get your coordinates.</p>
|
|
|
|
<button onclick="getLocation()">Try It</button>
|
|
|
|
<p id="demo"></p>
|
|
|
|
<script>
|
|
const 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>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
|
|
|