Fearless Forums
Speed calculator - Printable Version

+- Fearless Forums (https://fearlessrp.net)
+-- Forum: General Discussion (https://fearlessrp.net/forumdisplay.php?fid=10)
+--- Forum: Discussions (https://fearlessrp.net/forumdisplay.php?fid=4)
+---- Forum: Archive (https://fearlessrp.net/forumdisplay.php?fid=481)
+---- Thread: Speed calculator (/showthread.php?tid=93021)



Speed calculator - Haarek - 06-07-2019

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?


RE: Speed calculator - Lewwings - 06-07-2019

I like it, good stuff Midget Smile


RE: Speed calculator - Haarek - 09-12-2019

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.


RE: Speed calculator - Grizzly - 09-12-2019

Nice, this is some good html coding


RE: Speed calculator - Slaint - 09-12-2019

Nice job midget!


RE: Speed calculator - Conn - 09-12-2019

Nice, is that plain HTML or HTML and JS or some similar lang?


RE: Speed calculator - Haarek - 09-13-2019

(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]