<div id="vivod_18">
<div class="container">
<div class="row">
<h3 class="vniz">Вывод с таймаутом и интервалом</h3>
<div class="col-12 vniz">
<input type="text" id="inp_odin">
<input type="text" id="inp_dva">
<input type="button" value="Вывести" onclick="myVivod()">
</div>
<p id="out_18"></p>
</div>
</div>
</div>
function myVivod() {
var first= 1*document.getElementById("inp_odin").value,
last = 1*document.getElementById("inp_dva").value;
if(1===(first&1)) first+=1;
setTimeout(next,1000,first,last);
}
function next(first,last){
if(first>last) return;
var out = document.getElementById("out_18");
out.innerHTML +=first + " ";
setTimeout(next,1000,first+2,last);
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.