Java Reference
In-Depth Information
function window_onload()
{
setTimeout(“switchImage()“,3000);
}
function switchImage()
{
currentImgNumber++;
document.imgAdvert.src = 'AdvertImage' + currentImgNumber + '.jpg';
if (currentImgNumber < numberOfImages)
{
setTimeout(“switchImage()“,3000); }
}
</script>
</head>
<body onload=”window_onload()“>
<img src=”AdvertImage1.jpg” name=”imgAdvert” />
</body>
</html>
After you've typed in the code, save the page as adverts.htm . You'll also need to create three images
named AdvertImage1.jpg , AdvertImage2.jpg , and AdvertImage3.jpg (alternatively, the three
images are supplied with the downloadable code for the topic).
When the page is loaded, you start with a view of AdvertImage1.jpg, as shown in Figure 10-5.
Figure 10-5
In three seconds, this changes to the second image, shown in Figure 10-6.
Figure 10-6
Search WWH ::




Custom Search