Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

JavaScript Slideslow Help

  • 09-11-2013 12:21AM
    #1
    Registered Users, Registered Users 2 Posts: 2,369 ✭✭✭


    Hey there I would appreciate any help you can give me. I've developed a pretty basic slideshow for my website assignment for college.

    I was looking through a couple of mercedes-benz websites for research and found slideshow @ http://www.bradysmercedes-benz.ie I really liked the way it gives the user control of the slideshow with the toggle button.

    So far I'm stuck on how to implement a toggle button so I can give users control over my slideshow. Is there anyway I can add it in the code below without starting from scratch?

    I would appreciate any help!


    This is the code below:

    <script type="text/javascript">
    //declare variables

    var image1=new Image()
    image1.src="images/premises.jpg"
    var image2= new Image()
    image2.src="images/a-class.jpg"
    var image3=new Image()
    image3.src="images/s-saloon.jpg"
    var image4=new Image()
    image4.src="images/e-front.jpg"
    var image5=new Image()
    image5.src="images/C-Class.jpg"

    </script>

    <div id="body">

    <!-- Slideshow JavaScript -->


    <a href="javascript:slidelink()"><img src="images/C-Class.jpg" name="slide" width="770" height="370" id="slideshow" /></a>
    <script>
    //variable that will increment through the images
    var step=1

    //variable that will keep track of the image currently being displayed
    var whichimage=1

    function slideit(){

    //if browser does not support the image object, exit.
    if (!document.images)
    return
    document.images.slide.src=eval("image"+step+".src")
    whichimage=step

    if (step<5)
    step++

    else
    step=1

    //call function "slideit()" every 2.5 seconds
    setTimeout("slideit()",3500)
    }
    slideit()
    function slidelink() {
    if (whichimage==1)
    window.location="about.htm"
    else if (whichimage==2)
    window.location="link2.htm"
    else if (whichimage==3)
    window.location="link3.htm"
    else
    window.location="link4.htm"
    }
    </script>


Comments

Advertisement