Results 1 to 2 of 2

Thread: How do I a 'GoTo' ?

  1. #1
    Join Date
    Nov 2003

    How do I a 'GoTo' ?

    Hello everybody

    In old Basic we can use the simple directive GOTO to go back to a precise point in the program.

    In JavaScript, I would like to go back to a point in the .htm file, after having done a setTimeout('xxx()', n)
    Is this possible? My goal is to make a slideshow with an array containing the images names and a counter for pointing the image from the array.

    Many Thanks in advance.

  2. #2
    Join Date
    Nov 2003
    I am not too sure about a GoTo.... I thought they were now considered bad programming practise?

    But this may be of help...
    In head...

    var runner = new Array(6);
    var curRunner = 0;
    var startRunning;

    runner[0] = "runner0.jpg";
    runner[1] = "runner1.jpg";
    runner[2] = "runner2.jpg";
    runner[3] = "runner3.jpg";
    runner[4] = "runner4.jpg";
    runner[5] = "runner5.jpg";

    function marathon() {
    if (curRunner == 5)
    curRunner = 0;
    document.animation.src = runner[curRunner];

    In body....

    <img src="runner0.jpg" name="animation">
    <input type="button" name="run" value=" run " onclick="startRunning=setInterval('marathon()', 100);">
    <input type="button" name"stop" value=" stop " onclick="clearOnterval(startRunning);">


    You refer to the source of an image in your javascript which will cycle through the images in an array at an interval of 100

    Hope this was some help, if you could help me I posted one called "changing text onClick()"

    Leigh Halliday - Student Programmer

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Recent Articles