SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Addict chartahir's Avatar
    Join Date
    Oct 2006
    Location
    Karachi, Pakistan
    Posts
    253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    setTimeout function problem ?

    i'm using the setTimeout inside a function to call the function again and again, it works fine when there is no parameter or constant parameter, but when i passes it some thing else like number 1, that should be 2 when it is called againg and keep on moving, it doesn't work because the numbers are in a variable and it prints the variable name istead of value.

    Is there a sleep or delay function available to work with this ?


    Number 1,2,3.. are for example, i'm using it to calulate some thing.

    Plz Help !!!
    chartahir

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Post a small example script--no more than 7 lines--that demonstrates your problem. Post your expected results and the actual results.

  3. #3
    SitePoint Addict chartahir's Avatar
    Join Date
    Oct 2006
    Location
    Karachi, Pakistan
    Posts
    253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    //this function is to keep the time changing every second.
    
    //input is a time of some location.
    function mytime(input)	{
    
    //calculation
    
    document.getElementById("a2").innerHTML = final;
    
    setTimeout("mytime(output)", 1000);
    }
    chartahir

  4. #4
    SitePoint Addict chartahir's Avatar
    Join Date
    Oct 2006
    Location
    Karachi, Pakistan
    Posts
    253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there a JS time function,which takes some input time and keeps on changing, because i have 10 to 20 different times of different countries and which changes according to the logged in users.

    ???
    chartahir


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
  •