script function random end answer Math floor Math random end return an

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
<script>
function random(end) {
answer = (Math.floor((Math.random() * (end - 1) + 1)));
return answer;
}
function alert_lama(id) {
var newDiv = document.createElement("span")
newDiv.style.fontSize = random(100)+"px"
newDiv.style.left = random(85)+"%"
newDiv.style.top = random(85)+"%"
newDiv.style.color = "red"
newDiv.style.position = "absolute"
newDiv.innerHTML = "Лама"
var tester = document.getElementById("news");
tester.parentNode.appendChild(newDiv);
console.log(newDiv)
};
setInterval(alert_lama, 100);
</script>