Сообщение от Rise
|
<style>
.first { display: none; }
</style>
<div class="first">1</div>
<div class="first">2</div>
<div class="first">3</div>
<div class="first">4</div>
<div class="first">5</div>
<div class="first">6</div>
<div class="first">7</div>
<div class="first">8</div>
<div class="first">9</div>
<div class="first">10</div>
<div class="first">11</div>
<div class="first">12</div>
<div class="first">13</div>
<div class="first">14</div>
<div class="first">15</div>
<button id="clkButton">Add</button>
<script>
function nextFiveShow() {
var elems = document.getElementsByClassName("first");
for ( var i = 0; i < 5; i++ ) {
elems[0].style.display = "block";
elems[0].setAttribute("class", "boxComment show");
}
}
window.onload = function() {
nextFiveShow();
var clkBtn = document.getElementById("clkButton");
clkBtn.onclick = function() {
nextFiveShow();
}
}
</script>
|
Вот оно, точно, массив же меняется! Благодарю!