G
Geoff Cox
Hello,
The following code works with
document.getElementById('picture').src = window["picture"][0].src;
but not if I increase the index to 1, ie
document.getElementById('picture').src = window["picture"][1].src;
Why is this?!
Geoff
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<HEAD>
<link rel=stylesheet href="slider.css" type="text/css">
<script type="text/javascript">
var picture = new Array();
var ig = 0;
var ig_max = 7;
function preload_imgs()
{
if(ig < ig_max)
{
picture[ig] = new Image();
picture[ig].onload = preload_imgs;
picture[ig].src = "pic" + ig + ".jpg";
ig++;
}
}
preload_imgs();
function fillTable()
{
document.getElementById('picture').src = window["picture"][0].src;
}
</script>
</head>
<body onload="fillTable()">
<table>
<tr>
<td><img ID='picture' src="" />loading</td>
</tr>
</table>
</body>
</html>
The following code works with
document.getElementById('picture').src = window["picture"][0].src;
but not if I increase the index to 1, ie
document.getElementById('picture').src = window["picture"][1].src;
Why is this?!
Geoff
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<HEAD>
<link rel=stylesheet href="slider.css" type="text/css">
<script type="text/javascript">
var picture = new Array();
var ig = 0;
var ig_max = 7;
function preload_imgs()
{
if(ig < ig_max)
{
picture[ig] = new Image();
picture[ig].onload = preload_imgs;
picture[ig].src = "pic" + ig + ".jpg";
ig++;
}
}
preload_imgs();
function fillTable()
{
document.getElementById('picture').src = window["picture"][0].src;
}
</script>
</head>
<body onload="fillTable()">
<table>
<tr>
<td><img ID='picture' src="" />loading</td>
</tr>
</table>
</body>
</html>