A ver si puedes sacar la idea de aquí:
Código Javascript
:
Ver originalwindow.onload = function() {
var test = document.getElementById("test");
var boton = document.getElementById("boton");
var input = document.getElementsByTagName("input");
var array = new Array();
boton.addEventListener('click', function(e) {
e.preventDefault();
array[0] = input[0].value;
array[1] = input[1].value;
array[2] = input[2].value;
//var var0 = img0.src;
//var var1 = img1.src;
//var var2 = img2.src;
var indice = "";
for (var i = 0; i < array.length; i++) {
if (array[i] === "") {
indice += "Campo " + i + "= " + "../vacia.png" + "<br />";
}
}
test.innerHTML = indice;
});
Código HTML:
Ver original<input type="text" value="" /> <input type="text" value="1" /> <input type="text" value="" /> <input type="button" id="boton" value="más" />