Speed calculator
#1
Made this speed calculator that gives you the time it will take to reach another object.

http://spiel.no/AA/speed.html

The thing I know I could improve is that I am declaring the same variables 2 times and just switching its name. 


What do you think? Was it interesting?
[Image: h2.png]
Visit my profile here.
The following 1 user Likes Haarek's post:
  • rino
#2
I like it, good stuff Midget Smile
 
[Image: jUcv1hb.png]
 
The following 1 user Likes Lewwings's post:
  • Haarek
#3
Code:
<html>

<div style="margin-left:600px; margin-top:200px;background-color:#CFDFF9;width:175px;padding:50px;border:solid 1px black;">

<input type="text" id="inputNumber"/> <br><br>
<button id="calculate">Finn</button>

<p id="display">--</p>
</div>

</div>
<script>


var calculate = document.getElementById('calculate');
    calculate.addEventListener('click', function(na){
    
    inputNumber = document.querySelector('#inputNumber').value;

    document.getElementById('display').innerHTML = '-';


    for(var x=1;x < 50; x++){

        result = inputNumber / x;
        console.log(result);

        for(var y=2;y<50;y++){

            if (result == y) {
            console.log('Whole number:', result)
            document.getElementById('display').innerHTML =
                inputNumber + ' / ' + result + ' = ' + x;
            }    
        }
    }


});

</script>
</html>

Finds the lowest number to divide by to add i.e fractions

If you want to try it just put it in a text document and open it with chrome.
[Image: h2.png]
Visit my profile here.
#4
Nice, this is some good html coding
Kind Regards,
Grizzly
#5
Nice job midget!
The following 1 user Likes Slaint's post:
  • Haarek
#6
Nice, is that plain HTML or HTML and JS or some similar lang?
Regards,
Connnnnnnn

Consider giving me a rep point here.

#7
(09-12-2019, 04:11 PM)Conn Wrote: Nice, is that plain HTML or HTML and JS or some similar lang?

It is HTML and javascript, I used HTML so I could give an input and the rest is JS.

[Image: Ul69drR.png]
[Image: h2.png]
Visit my profile here.
The following 1 user Likes Haarek's post:
  • Conn


Forum Jump:


Users browsing this thread: 1 Guest(s)