SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Threaded View

  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2007
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Timer won't work

    Hi
    I made a slideshow that works nicely but run into problems when I try to star/stop it.
    I get this error: uncaught exception: [Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://localhost/hydro.js :: <TOP_LEVEL> :: line 74" data: no]

    Line 0

    The code is below. Can anybody help?

    Code:
    var Pics = new Array();
    Index = 0;


    function LoadImages()
    {
    Pics[0] = new Image();
    Pics[0].src = "UE Hydro Scheme 001.jpg";
    .................................................. .......................
    Pics[21] = new Image();
    Pics[21].src = "Bonfirld Ghyll Hydro Bottom of Screw.jpg";

    document.images[0].src = Pics[0].src;
    }
    /**/
    Index1 = 0;
    function SetTimer()
    {
    Timer = setInterval("Animate()", 3000);
    }
    function Animate ()
    {
    Index1 ++;
    if (Index1 > 22) {
    Index1 = 0;
    };
    document.images[0].src = Pics[Index1].src;

    }
    var start = document.getElementById("start");
    addEventListener(start, "click", clickStart, false);
    var stop = document.getElementById("stop");
    addEventListener(stop, "click", clickStop, false);

    function clickStart()
    {
    Timer = setTimeout("Animate()", 2075);
    }

    function clickStop () {
    clearTimeout(Timer);

    }
    /Code
    Last edited by gleb; Sep 11, 2007 at 10:59. Reason: Adding error message


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
  •