Results 1 to 5 of 5

Thread: Interactive Image slideshow script code (simple?) help

  1. #1
    Join Date
    Dec 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face Interactive Image slideshow script code (simple?) help

    Hi, im trying to get the Interactive Image slideshow script to load without initialy playing. i get as far as changing the last onload variable to Stop, and all would be fine except the first image is not loaded. i only need a back and forward button, no play/stop function, and would like to keep the 1 of ... function. if any coders can give me some pointers i would be very grateful. heres my html:

    <td width="640" height="370" colspan="4"><img width="640" height="370" id="_Ath_Slide" onload="OnImgLoad()"></td>
    </tr>
    <tr>
    <td height="31" colspan="4">
    <img src="../images/spacer.gif" width="640" height="31" alt=""></td>
    </tr>
    <tr>
    <td width="640" height="9">
    <img src="../images/back.gif" width="7" height="9" alt="" onclick="Prev();" id="btnPrev"></td>
    <td height="9">
    <SPAN id="_Ath_FileName"> </SPAN>
    <b><SPAN id="_Ath_Img_X"></SPAN>/<SPAN id="_Ath_Img_N"></SPAN></b></p>

    <p align="center">

    <script language="JavaScript1.2">

    /*
    Interactive Image slideshow with text description
    By Christian Carlessi Salvadó (cocolinks@c.net.gt). Keep this notice intact.
    Visit http://www.dynamicdrive.com for script
    */


    g_fPlayMode = 0;
    g_iimg = -1;
    g_imax = 0;
    g_ImageTable = new Array();

    function ChangeImage(fFwd)
    {
    if (fFwd)
    {
    if (++g_iimg==g_imax)
    g_iimg=0;
    }
    else
    {
    if (g_iimg==0)
    g_iimg=g_imax;
    g_iimg--;
    }
    Update();
    }

    function getobject(obj){
    if (document.getElementById)
    return document.getElementById(obj)
    else if (document.all)
    return document.all[obj]
    }

    function Update(){
    getobject("_Ath_Slide").src = g_ImageTable[g_iimg][0];
    getobject("_Ath_FileName").innerHTML = g_ImageTable[g_iimg][1];
    getobject("_Ath_Img_X").innerHTML = g_iimg + 1;
    getobject("_Ath_Img_N").innerHTML = g_imax;
    }


    function Play()
    {
    g_fPlayMode = !g_fPlayMode;
    if (g_fPlayMode)
    {
    getobject("btnPrev").disabled = getobject("btnNext").disabled = true;
    Next();
    }
    else
    {
    getobject("btnPrev").disabled = getobject("btnNext").disabled = false;

    }
    }
    function OnImgLoad()
    {
    if (g_fPlayMode)
    window.setTimeout("Tick()", g_dwTimeOutSec*1000);
    }
    function Tick()
    {
    if (g_fPlayMode)
    Next();
    }
    function Prev()
    {
    ChangeImage(false);
    }
    function Next()
    {
    ChangeImage(true);
    }


    ////configure below variables/////////////////////////////

    //configure the below images and description to your own.
    g_ImageTable[g_imax++] = new Array ("1.jpg", "");
    g_ImageTable[g_imax++] = new Array ("2.jpg", "");
    g_ImageTable[g_imax++] = new Array ("3.jpg", "");
    g_ImageTable[g_imax++] = new Array ("4.jpg", "");
    g_ImageTable[g_imax++] = new Array ("5.jpg", "");
    g_ImageTable[g_imax++] = new Array ("6.jpg", "");
    g_ImageTable[g_imax++] = new Array ("7.jpg", "");
    g_ImageTable[g_imax++] = new Array ("8.jpg", "");
    g_ImageTable[g_imax++] = new Array ("9.jpg", "");
    g_ImageTable[g_imax++] = new Array ("10.jpg", "");
    g_ImageTable[g_imax++] = new Array ("11.jpg", "");
    g_ImageTable[g_imax++] = new Array ("12.jpg", "");
    g_ImageTable[g_imax++] = new Array ("13.jpg", "");
    g_ImageTable[g_imax++] = new Array ("14.jpg", "");
    g_ImageTable[g_imax++] = new Array ("15.jpg", "");
    g_ImageTable[g_imax++] = new Array ("16.jpg", "");
    g_ImageTable[g_imax++] = new Array ("17.jpg", "");
    g_ImageTable[g_imax++] = new Array ("18.jpg", "");
    g_ImageTable[g_imax++] = new Array ("19.jpg", "");
    g_ImageTable[g_imax++] = new Array ("20.jpg", "");
    //extend the above list as desired
    g_dwTimeOutSec=5

    ////End configuration/////////////////////////////

    if (document.getElementById||document.all)
    window.onload=Stop
    </script>


    thanks in advance.
    Brodie

  2. #2
    Join Date
    Jan 2005
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    For quick workaround, find line that says:

    Code:
    window.onload=Play
    and add this right below it on the next line:
    Code:
    Play()
    All the above applies to original code from this URL: http://www.dynamicdrive.com/dynamici...interslide.htm

  3. #3
    Join Date
    Dec 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank FPit but it doesnt seem to work. i tried it with the original code too. i can get the show not to autoplay by changing the onload to stop, but then the first image doesnt appear, you have to hit "next" in order to see it. I only need to have the first image appear by default without the autoplay, but i have no idea how?
    thanks

  4. #4
    Join Date
    Jan 2005
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I was saying to change this:
    window.onload=Play

    to:
    window.onload=Play
    Play()


    Just add Play() after that line, don't remove any lines or words. This will work on original code.

  5. #5
    Join Date
    Dec 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok, tried again and wittled away at the code, to find that the script had to come after all the input types. thanks for your help!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •