var n=15; var image; for( array = [], i=2; i<n; i++){ image = new Image; image.src = 'image/' + i + '.jpg' ; array.push( image ) ; }; for(var i=0,b;b=array[i];i++) document.body.appendChild(b);