Random conclusion
-
There is a code:
<div id="show1" style="display: none;">Текст1<div> <div id="show2" style="display: none;">Текст2<div> <div id="show3" style="display: none;">Текст3<div> <div id="show4" style="display: none;">Текст4<div> <div id="show5" style="display: none;">Текст5<div>
<script>
var a;function getRandom() {
return Math.random();
}a = getRandom();
a = a * 5;if (0 < a < 1) {
d = document.getElementById('show1').style.display = "";
}
if (1 < a < 2) {
d = document.getElementById('show2').style.display = "";
}
if (2 < a < 3) {
d = document.getElementById('show3').style.display = "";
}
if (3 < a < 4) {
d = document.getElementById('show4').style.display = "";
}
if (4 < a < 5) {
d = document.getElementById('show5').style.display = "";
}
</script>
What's the mistake?
-
We need to return the rand in your case only between 1 and 5