Javascript setInterval

Last post 07-09-2008 11:34 AM by NC01. 3 replies.

Sort Posts:

  • Javascript setInterval

    07-08-2008, 5:38 PM

    Hi:

           Can any one suggest me how to implement the Code 1 logic into Code 2.I have mentioned the code1, code2 below.

     

    Code1:

     function init()
    {
     for (var i=0; i<8; i++)
     {
      document.getElementById('btn' + i).displayValue = i;
      document.getElementById('btn' + i).onclick = function(){display(this.displayValue);};
     }
    }

     

     

    Code2:

    var i;moveTimer = new Array(8); for(i=0;i<8;i++)
    {

    moveTimer[i] = window.setInterval(function() {moveSlideLeft('img' + i);},50);
    }

     

    Thanks:

    Suresh

     

    Filed under:
  • Re: Javascript setInterval

    07-09-2008, 1:16 AM
    • Contributor
      2,342 point Contributor
    • Maulik Patel
    • Member since 12-21-2007, 6:48 AM
    • Ahmedabad
    • Posts 333

    What actually you want to do ? you want to merge code1's logic to code2 ? OR Refine your problem so people can answer better. 

    Maulik Patel
    MCTS, Software Engineer

    Don't forget to click "Mark as Answer" on the post that helped you. This will give you point and help readers to know which post solved your issue and make their search easy.
  • Re: Javascript setInterval

    07-09-2008, 2:49 AM
    Answer
    • Contributor
      3,091 point Contributor
    • sameer_khanjit
    • Member since 12-10-2007, 1:06 PM
    • Indore India
    • Posts 638

     function init()
    {

    var moveTimer = new Array(8);
     for (var i=0; i<8; i++)
     {
      document.getElementById('btn' + i).displayValue = i;
      document.getElementById('btn' + i).onclick = function(){display(this.displayValue);};

    moveTimer[i] = window.setInterval(function() {moveSlideLeft('img' + i);},50);
     }
    }

     


     

    We Are Looking for .NET/PHP Projects

    Contact Details :-

     Email - sameer.khanjit@gmail.com

     Mobile no. : +91-9893795983

     View Blog

    linkedin Asp.net Group

    Don't forget to click “Mark as Answer” on the post that helped you
  • Re: Javascript setInterval

    07-09-2008, 11:34 AM
    Answer
    • All-Star
      74,705 point All-Star
    • NC01
    • Member since 08-26-2005, 3:33 PM
    • Posts 13,868

    All ready answered here: http://forums.asp.net/t/1286883.aspx

    Please don't make duplicate posts.

    NC...

     

Page 1 of 1 (4 items)