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 Image Slider

  • 21-02-2005 03:39PM
    #1
    Closed Accounts Posts: 4,655 ✭✭✭


    I am using the code below to try and generate a slideshow of image. However the problem is the number of images is not a constant.

    Plus aswell the following is not working in Mozilla or Netscape - does anyone have any ideas?
    <SCRIPT LANGUAGE="JavaScript">
    var rotate_delay = 5000; // delay in milliseconds (5000 = 5 secs)
    current = 0;
    function next() {
    document.images.show.src = "dynamic_image_link";
    }
    function previous() {
    document.images.show.src = "dynamic_image_link";
    }
    function first() {
    document.images.show.src = "dynamic_image_link";
    return true;
    //document.slideform.slide.selectedIndex = 0;
    }
    
    function ap(text) {
    document.slideform.slidebutton.value = (text == "Stop") ? "Start" : "Stop";
    rotate();
    }
    function change() {
    current = document.slideform.slide.selectedIndex;
    document.images.show.src = document.slideform.slide[current].value;
    }
    function rotate() {
    if (document.slideform.slidebutton.value == "Stop") {
    //current = (current == document.slideform.slide.length-1) ? 0 : current+1;
    document.images.show.src = "dynamic_image_link";
    //document.slideform.slide.selectedIndex = current;
    window.setTimeout("rotate()", rotate_delay);
    return true;
       }
    }
    //  End -->
    </script>
    </HEAD>
    
    <BODY>
    
    <center>
    <form name=slideform>
    <table cellspacing=1 cellpadding=4 bgcolor="#000000">
    <tr>
    <td align=center bgcolor="white">
    <b>Image Slideshow</b>
    </td>
    </tr>
    <tr>
    <td align=center bgcolor="white" width=200 height=150>
    <img src="dynamic_image_link" name="show">
    </td>
    </tr>
    <tr>
    <td align=center bgcolor="#C0C0C0">
    <input type=button onClick="first();" value="|<<" title="Reset">
    <input type=button onClick="previous();" value="<<" title="Previous">
    <input type=button name="slidebutton" onClick="ap(this.value);" value="Start" title="AutoPlay">
    <input type=button onClick="next();" value=">>" title="Next">
    </td>
    </tr>
    </table>
    </form>
    </center>
    


Advertisement