图片不会显示在javascript幻灯片中,我已经研究了三天了,对此我感到厌烦。我什至开始作弊,只是复制我在网上看到的其他滑块(开源)并使用它们。这是工作,请帮助我。

<div id="slideshow" style="width:960px;height:500px;overflow:hidden;">
  <div id="slideshowimage" style="width:960px;height:500px;overflow:hidden;">
  </div>
  <div id="slideshowcontrols" style="width:960px;height:500px;overflow:hidden;">
    <a onClick="alterimage(-1);">Prev</a>
    <a onClick="alterimage(1);">Next</a>
  </div>
</div>

<script type="text/javascript">
    var images = new Array;
    images[1] = "Images/image1.jpg";
    images[2] = "Images/image2.jpg";
    images[3] = "Images/image3.jpg";
    var presentimage = 1;
    function alterimage(alter){
        presentimage += alter;
        document.getElement('slideshow').innerHTML = presentimage;
    }
    alterimage(0);
</script>

最佳答案

没有getElement这样的功能,应该为getElementById

document.getElementById('slideshow').innerHTML = presentimage;

关于javascript - 图片不会显示在javascript幻灯片中,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20847828/

10-09 07:49
查看更多