1

我在一个网页上遇到了多个 javascript 幻灯片的问题。我可以让一个幻灯片放映设置正常工作,但是当我把其他幻灯片放映设置好时,我认为这些脚本正在相互抵消。请帮忙。

这是标题中的js:

</script>  
<script type="text/javascript">
var image1 = new Image()
image1.src = "images/linen/ldp-1.jpg"
var image2 = new Image()
image2.src = "images/linen/ldp-2.jpg"
var image2 = new Image()
image2.src = "images/linen/ldp-3.jpg"
var image2 = new Image()
image2.src = "images/linen/ldp-4.jpg"
</script>

<script type="text/javascript">
var image5 = new Image()
image5.src = "images/linen/ldp-5.jpg"
var image6 = new Image()
image6.src = "images/linen/ldp-6.jpg"
var image7 = new Image()
image7.src = "images/linen/ldp-7.jpg"
var image8 = new Image()
image8.src = "images/linen/ldp-8.jpg"
</script>

这是身体:

<div align="center">
         <img src="images/linen/ldp-1.jpg" width="300" height="300" name="slide" />
<script type="text/javascript">
    var step=1;
    function slideit()
    {
        document.images.slide.src = eval("image"+step+".src");
        if(step<2)
            step++;
        else
            step=1;
        setTimeout("slideit()",3000);
    }
    slideit();
</script>

<img src="images/linen/ldp-5.jpg" width="300" height="300" name="slide" />
<script type="text/javascript">
    var step=1;
    function slideit()
    {
        document.images.slide.src = eval("image"+step+".src");
        if(step<2)
            step++;
        else
            step=1;
        setTimeout("slideit()",3000);
    }
    slideit();
</script>

4

1 回答 1

0

第二步使用不同的步长变量。

于 2013-11-02T02:52:38.363 回答