1
Hello, I have to do a function in javascript, however, I need to put a time interval in a while within that function (run the function while 1 time per second). Being that I have to make all this appear in a div in html
function rotateText(id,dt)
{
var f = document.getElementById("id").value;
var cont = 0;
var fa, b, fb, c, y = [];
// Esse while tem que ter o intervalo
while(cont != 100){
fa = f.length;
fa = fa - 1;
b = f.charAt(fa);
fb = f.slice(0,fa);
c = b.concat(fb);
y = y +"<br>"+ c
f = c;
document.getElementById("Cosas").innerHTML = y;
cont = cont + 1;
}
}
window.addEventListener('DOMContentLoaded', function() {
rotateText(id, 1000);
}, false);
Thanks, it worked out!
– Pedro Freitas
Glad I could help
– Douglas