mardi 10 juillet 2018

How do I create A JavaScript Random Number Generator That Uses HTML Input, and Button Elements?

My goal is to create a random number generator that accepts user input via HTML, and allows the user to click "submit" in order to return a random number between the 2 values.

I AM STUCK... Where do I go from here?

HTML: -------------------------------------------------------------------------

<html>

<input type="text" class="min"><br>
<input type="text" class="max"><br>
<button class="button">Submit</button>

</html>

Javascript:---------------------------------------------------------------------

function myRand(min, max) {

var min = document.getElementByClassName(min).value;

var max = document.getElementByClassName(max).value;

var button = document.getElementByClassName(button);

var result = Math.floor(Math.random()) * (max - min) + min;

return result;
}




Aucun commentaire:

Enregistrer un commentaire