var imageArray = new Array('images/1.jpg', 'images/2.jpg', 'images/3.jpg', 'images/4.jpg', 'images/5.jpg', 'images/1.jpg', 'images/2.jpg', 'images/3.jpg', 'images/4.jpg', 'images/5.jpg');
function preloadImages() {
for (var i in imageArray) {
var image = new Image();
image.src = imageArray[i];
}
}
function init() {
if (navigator.appName == 'Microsoft Internet Explorer') {
var fragment = document.createDocumentFragment();
var table = document.createElement('table');
var tbody = document.createElement('tbody');
for ( var i in imageArray) {
if (i%5 == 0) {
var tr = document.createElement('tr');
}
var td = document.createElement('td');
var image = document.createElement('img');
image.setAttribute('alt', imageArray[i]);
image.setAttribute('src', imageArray[i]);
td.appendChild(image);
tr.appendChild(td);
tbody.appendChild(tr);
table.appendChild(tbody);
fragment.appendChild(table);
}
var content = document.getElementById('content');
content.appendChild(fragment);
} else {
var fragment = document.createDocumentFragment();
var table = document.createElement('table');
for ( var i in imageArray) {
if (i%5 == 0) {
var tr = document.createElement('tr');
}
var td = document.createElement('td');
var image = document.createElement('img');
image.setAttribute('alt', imageArray[i]);
image.setAttribute('src', imageArray[i]);
td.appendChild(image);
tr.appendChild(td);
table.appendChild(tr);
fragment.appendChild(table);
}
var content = document.getElementById('content');
content.appendChild(fragment);
}
}