Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6954813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:39:19+00:00 2026-05-27T14:39:19+00:00

This is my function, when called the related node turns red and then does

  • 0

This is my function, when called the related node turns red and then does nothing.

Here is the javascript:

function blink (node, flickers)
{
    originalColour = node.style.color;
    for (i = 1; i <= (flickers*2); i++)
        {
        setTimeout (function () {ChangeColor (node, (((i%2) == 0) ? (originalColour) : ('red')))}, (i*200));
        }
}
function ChangeColor (node, color) 
{
    node.style.color = color;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:39:19+00:00Added an answer on May 27, 2026 at 2:39 pm

    i is “i when the anonymous function is called” not “i when setTimeout is called”.

    You need to create a closure and pass the current value of i into it.

    function ChangeColorLater(i) {
        return function () {
            ChangeColor (node, (((i%2) == 0) ? (originalColour) : ('red')))
        }
    }
    
    setTimeout (ChangeColourLater(i), (i*200));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this function called ProperCase that takes a string, then converts the first
On the click of a button this Javascript is called: var xmlhttp; function register()
This is a related (and or follow up) issue to : Event Function called
I have a function which calculates distance from database records. This function is called
I called this function once per frame and it took my FPS from >400
Suppose I have a free function called InitFoo . I'd like to protect this
Now I'm sure this is super easy, I have a function called remove_deposit which
I have this in my class When the second function is called php errors
I have this code which is called at an onChange event of an function
In Python there is a built-in function called dir . This is used to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.