I need some help with the source code below:
CSS :
img {
display: block;
}
Javascript :
var total = 5;
var numero = 1;
function mostrar() {
if (numero <= total) {
var inicio = (numero - 1) * 1 + 1;
for (var x = inicio; x < inicio + 1; x++) {
document.getElementById('resultado').appendChild(document.getElementById(x));
}
numero++;
}
}
var imagens = 5;
function apagar() {
if (imagens != 0)
for (var i = imagens; i > imagens - 1 ; i--) {
document.getElementById(i).style.display = "none";
}
imagens = i;
}
HTML :
<center>
<div id="resultado"> </div>
<hr width="33%">
<input type="button" value="mostrar" onclick="mostrar()" /> | <button onclick="apagar();">esconder</button>
</center>
<span id="dados" style="display:none">
<img src="https://sites.google.com/site/mplayerplugin/thumbnails/1.jpg"id='1'> <imgsrc="https://sites.google.com/site/mplayerplugin/thumbnails/2.jpg" id='2'>
<img src="https://sites.google.com/site/mplayerplugin/thumbnails/3.jpg"id='3'> <imgsrc="https://sites.google.com/site/mplayerplugin/thumbnails/4.jpg" id='4'>
<img src="https://sites.google.com/site/mplayerplugin/thumbnails/5.jpg" id='5'>
</span>
It works almost perfectly, the problem is that .. does not back print the HTML images after they are removed.