basti1012.bplaced.net

Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
    Zeigt Position , Entfernung und Geschwindigkeit an

    Code

                                        
                                     <style>
     table{
     width:100%;
     border:2px solid whithe;
     }
     td{
     color:white;
     font-size:25px
     }
     </style>
    <body style="background-color:#000000"; width: 100%; max.width: 200px; margin: auto>
      <table border="1" width="100%" height="40%" style="background-color:rgb(0,0,0)" margin=auto>
        <tbody>
    
     <tr><td>Kmh</td><td><span id="getspeed">0</span></td></tr>
     <tr><td>Lat</td><td><span id="getlat">0</span></td></tr>
     <tr><td>Lon</td><td><span id="getlng">0</span></td>  </tr>
      <tr><td>Gesammt</td><td><span id="ges">0</span></td>  </tr> 
      <tr><td>Meter/sec</td><td><span id="ff">0</span></td></tr>
     <tr><td>Time</td><td><span id="tim">0</span></td>  </tr> 
         </tbody>
        </table>
        <script>
        y=document.querySelector("#getlat");
        x= document.querySelector("#getlng");
        c=  document.querySelector("#getspeed");
      l = document.getElementById('ges');
          t = document.getElementById('tim'); 
        g=50;
        time=0;
        min=0;
        var alles=0;
            function updateSpeed() {
                if (navigator.geolocation) {
                      navigator.geolocation.getCurrentPosition(function (position) { 
                       y.innerHTML = position.coords.latitude;
                       x.innerHTML = position.coords.longitude;
                      j=position.coords.speed * 3.6;
                      time++;
                      c.innerHTML =j.toFixed(2);
                      gess=j.toFixed(2)/3600;
                      alles+=gess;
                      ge=gess*1000;
                      ff.innerHTML=ge.toFixed(4);
                      l.innerHTML=alles.toFixed(3);
                      if(time%60==0){
                         min++;
                         time=0;
                      }
                      if(time<10){
                         t.innerHTML=min+' : 0'+time;
                      }else{
                        t.innerHTML=min+' : '+time;
                      }
                    });
                } else {
                  // c+= 'geoloc not avail<br>';
                }
            }
            updateSpeed();
           setInterval(updateSpeed, 1000);
        </script>