HTML and CSS Reference
In-Depth Information
Ein erstes Beispiel einer One-Shot-Positionsanfrage:
<! HTML5 Geoposition One Shot Anfrage
Markus Spiering / Sven Haiges
>
<!DOCTYPE html>
<head>
<title>One Shot Anfrage</title>
<meta name "layout" content "webkit" />
<meta content "minimum scale 1.0, width device width, maximum
scale 0.6667, user scalable no" name "viewport" />
<link href "style.css" rel "stylesheet" media "screen" type "text/css" />
<! Einladen/Aufruf der Google Maps API Version 3 >
<script type "text/javascript"
src "http://maps.google.com/maps/api/js?sensor true">
</script>
<script>
(function my() {
var $i {};
$i.vars {};
$i.init function()
{
if ($i.hasGeo)
{
navigator.geolocation.getCurrentPosition($i.showLocation,
$i.handleError, {timeout:30000, maximumAge:300000, enableHighAccuracy:true})
}
else
document.getElementById('message').innerHTML 'Geo Location API
nicht verf&uuml;gbar!';
};
$i.showLocation function(position)
{
document.getElementById('message').innerHTML 'latitude: ' +
position.coords.latitude + ' / longitude: ' + position.coords.longitude + '
/ accuracy: ' + position.coords.accuracy + 'meters (acquired '+new
Date(position.timestamp)+')';
var latlng new google.maps.LatLng(position.coords.latitude,
position.coords.longitude);
var myOptions {
zoom: 13,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
Search WWH ::




Custom Search