Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Javascript Image Slider

Options
  • 21-02-2005 3: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