幻灯片不会改变来源

时间:2014-12-21 13:31:02

标签: javascript image slideshow

我试图制作幻灯片,似乎无法让图片来源发生变化。我需要帮助才能弄清楚我的代码出了什么问题?

使用Javascript:

var ImageStorage = new Array(
"..\Portfolio\Images\Slideshow\Seal.png",
"..\Portfolio\Images\Slideshow\Squirrel.png",
"..\Portfolio\Images\Slideshow\SuperSeal.png"
);

var Image = document.getElementById("SlideImage");
var Image_length = currentImage.length -1;
var index = 0;
var currentImage = ImageStorage[index];

function Slideshow()
{
    if(index < Image_length)
    {

        Image.src = currentImage;
        index +=1;
    }
    else
    {
        index = 0;
        Image.src = currentImage;

    }
setInterval("Slideshow()",2000);
}

HTML:

<!DOCTYPE html>
<html>
<head>
</head>
<title> Portfolio </title>
<link href="Style/Style.css" rel="stylesheet" type="text/css" />
</html>

<body> 
    <table class="ButtonsBorder">
        <table class="Buttons">
            <td><a  href=""><img class="Home" src="..\Portfolio\Images\Home_button.png" href="#" > </a></td>
            <td><a  href=""><img class="Gallery" src="..\Portfolio\Images\Gallery_button.png" href="#" > </a></td>
            <td><a  href=""><img class="Contact" src="..\Portfolio\Images\Contact_button.png" href="#" > </a></td>
            <td><a href=""><img  class="CV" src="..\Portfolio\Images\CV_button.png" href="a" > </a></td>
        </table>
    </table>
    <table class="Slides">
        <img  id="SlideImage" class="SlideImage" src="..\Portfolio\Images\Slideshow\SuperSeal.png" onload="Slideshow();">
        <script language="javascript" type="text/javascript" src="..\Portfolio\Main_Photoframe.js"></script>
    </table>
</body>

我很抱歉代码格式不好,我希望它具有可读性。

0 个答案:

没有答案