This code is courtesy of Glenn Davis at Project Cool. If you use it, you should put a reference to him as the author somewhere in the code as a comment (it's the right thing).
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>some webpage</title>
<script type="text/javascript">
function preLoad(){
if (document.images) {
pictures = new MakeArray(7)
pictures[1].src = "images/pic1.gif"
pictures[2].src = "images/pic2.gif"
pictures[3].src = "images/pic3.gif"
pictures[4].src = "images/pic4.gif"
pictures[5].src = "images/pic5.gif"
pictures[6].src = "images/pic6.gif"
}
}
function MakeArray(n) {
this.length = n
for (var i = 1; i<=n; i++) {
this[i] = new Image()
}
return this
}
</script>
</head>
<body onLoad="preLoad();">
</body>
</html>