Good day.
The random number generator does not work for me the way I wanted. Note the comments inside the JS code. The problem is that if on a line in var raund = Math.floor(Math.random() * (ot) + **вставить переменную ->** doo); code does not work. And if as I indicated in the example, it works, but not the proofreader. Just do not put in the example from 50 to 100, everything will work, and when 444, 1244 - no.
$(".rezult").html("dfgdf"); $(function() { $("input[name='Go']").click(function() { var ot = $(".ot").val(); var doo = $(".do").val(); var rezutl = doo - ot; //Так работает //НУЖНО ЗАКОММЕНТИРОВАТЬ var raund = Math.floor(Math.random() * (ot) + rezutl); //Работает//НУЖНО ЗАКОММЕНТИРОВАТЬ //var raund = Math.floor(Math.random() * (ot) + doo); //А так нет $(".rezult").html("<h1>" + "Результат: " + raund + "</h1>"); }); }); .ot { height: 100px; max-width: 180px; font-size: 57px; color: aquamarine; margin: 0 14px 0 0; } .do { height: 100px; max-width: 180px; font-size: 57px; color: #59aef1; } .button { margin: 20px 0px 0px 0px; height: 50px; width: 200px; background: #fff; color: cadetblue; font-size: 22px; cursor: pointer; border: 1px solid cadetblue; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <center> <div class="generator_chisel"> <h1>Генератор случайных чисел</h1> <div class="rezult"> </div> <form action="" name="activ"> <input type="number" name="ot" class="ot" placeholder="ОТ"> <input type="number" name="do" class="do" placeholder="ДО"><br> <input type="button" name="Go" value="Генерировать" class="button"> </form> </div> </center>