我可以成功地在 html 中制作幻灯片,但我试图制作两个但它不起作用,这是我的代码:
<script type="text/javascript">
var image1 = new Image()
image1.src = "img/home/residential.gif"
var image2 = new Image()
image2.src = "img/home/1.gif"
var image3 = new Image()
image3.src = "img/home/2.gif"
</script>
<table align="center" width="70%"cellpadding=5 cellspacing=5>
<tr>
<td rowspan=2 align=center><a href="artistic.html"><figure><img src="logo1.gif" alt="Atristic Impressions" width="400" height="600" name="slide"/><figcaption style="color: #610B21">Artistic Impressions</figure></td>
<script type="text/javascript">
var step=1;
function slide()
{
document.images.slide.src = eval("image"+step+".src");
if(step<3)
step++;
else
step=1;
setTimeout("slide()",5000);
}
slide();
</script>
<script type="text/javascript">
var image1 = new Image()
image1.src = "img/barns/1.gif"
var image2 = new Image()
image2.src = "img/barns/2.gif"
var image3 = new Image()
image3.src = "img/barns/3.gif"
var image4 = new Image()
image4.src = "img/barns/4.gif"
</script>
<td align=center><a href="Barns.html"><figure><img src="img/barns/1.gif" alt="Barn Conversions" width="400" height="300" name="slide"/ ><figcaption style="color: #610B21">Barn Conversions</figure></td>
<script type="text/javascript">
var step=1;
function slideit()
{
document.images.slide.src = eval("image1"+step+".src");
if(step<3)
step++;
else
step=1;
setTimeout("slideit()",5000);
}
slideit();
</script>