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

  • Home
  • SEARCH
  • 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 8098693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:09:20+00:00 2026-06-05T22:09:20+00:00

I used this tutorial to create a basic Javascript function for implementing change during

  • 0

I used this tutorial to create a basic Javascript function for implementing change during a given period of time.

function fadetext(){ 
if(hex>0) {
hex-=11;
document.getElementById("sample").style.color="rgb("+hex+","+hex+","+hex+")";
setTimeout("fadetext()",20); 
}
else
hex=255
}

Question 1: How to enter variable via function; e.g. fadetext(element, time). I was unable to do so by simply replacing the values with variables.

Question 2: Is it the standard (and right) method to gradually implement a change by javascript? The confusion point for me is that we use fadetext() function inside its own function. Doesn’t this make overload?

  • 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-06-05T22:09:23+00:00Added an answer on June 5, 2026 at 10:09 pm

    You need to pass a function, not a string, to setTimeout:

    function fadeText(element, duration) {
        ...
        setTimeout(function() {
            fadeText(element, duration);
        }, 20);
    }
    

    This code passes an anonymous function which captures the original parameters in a closure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What tools are used to create installers like this: EDIT: Here's a full tutorial:
I've used the exact files from this tutorial: http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/ The ideea is to submit
I used this MSDN tutorial to create an eye candy look for all the
Im trying to create a multilanguage website.I used this http://www.phpsimplicity.com/tips.php?id=15 tutorial and it works
Hi I have used this tutorial http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/ to create php - jquery - ajax
I used this link http://blog.androgames.net/85/android-accelerometer-tutorial/ to create an accelerometer. But I want that this
I used this tutorial http://delphi.about.com/od/kbthread/a/thread-gui.htm to create a class that asynchronously downloads a file
I've used this tutorial in order to create and populate my own SQLite database
I've used this tutorial to create an app with a table view that is
I used this simple tutorial to create my singleton class. Everything works fine. One

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.