我的图片幻灯片代码无法正常工作

时间:2015-01-11 18:06:20

标签: javascript image slideshow

我试图用Javascript和HTML创建一个图像循环(或幻灯片放映,因为我已经听过它)。我编写了这个代码位,但它似乎没有用。什么阻止它工作?有人要求添加HTML。我还在图像集中添加了等号,因为这并没有解决问题。

<img src = '' id = 'HeaderPhotoImage'></img>

<button id = 'Change' onclick = ChangeImage()>Change</button>

&#13;
&#13;
function ChangeImage() {

    var ImageOne = new Image();
    ImageOne.src = 'http://images.visitcanberra.com.au/images/canberra_hero_image.jpg';
    var ImageTwo = new Image();
    ImageTwo.src ='http://upload.wikimedia.org/wikipedia/commons/b/b6/Image_created_with_a_mobile_phone.png';
    var ImageThree = new Image();
    ImageThree.src = 'http://imageswiki.com/wp-content/uploads/2014/11/images-ImageVaultHandler.jpg';
    var ImageFour = new Image();
    ImageFour.src = 'http://www.wonderplugin.com/wp-content/plugins/wonderplugin-lightbox/images/demo-image2.jpg';
    var ImageSet=[ImageOne.src, ImageTwo.src, ImageThree.src, ImageFour.src];
    var CallImage = document.getElementById('HeaderPhotoImage').innerHTML;
    CallImage.src = ImageSet[0];
}
&#13;
&#13;
&#13;

0 个答案:

没有答案