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 8816897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:43:34+00:00 2026-06-14T04:43:34+00:00

I am having trouble with setTimeout() , I guess. You can visit my webpage

  • 0

I am having trouble with setTimeout(), I guess.

You can visit my webpage to see where I am at: http://verbum.xtrweb/soon.php

The problem is that i have 2 text fields.

  1. “Verbum” with id="Verbum"
  2. “Forget about single searches” with id="forget"

I want to apply a fade in effect after the tiny dictionaries fall (please see my site link above so you understand). I have changed the function’s name and variables too, but the only thing that happens is that only one of the texts fades in, and it depends on the order of which one is below the other. The one that does not fade in does not even appear. Hope you understood and find and anwser. Thanks.

<script type="text/javascript">
  var opac = 0.0;
  var alpha = 0;

  function init() {
    var elem = document.getElementById("Verbum");
    elem.style.display = 'inline';
    elem.style.filter = "alpha(opacity = " + alpha + ")";
    elem.style.opacity = opac;

    setTimeout("fadein()", 8500);
  }

  function fadein() {
    var elem = document.getElementById("Verbum");

    opac = opac + 0.1;
    alpha = parseInt(opac * 100);
    elem.style.opacity = opac;
    elem.style.filter = "alpha(opacity = " + alpha + ")";

    if (opac < 1.0) {
      //Change the 50 to adjust the speed. The higher the number, the slower the fade
      setTimeout("fadein()", 30);
    }

  }
  window.onload=init;
</script>

Here is the second <script> block:

<script type="text/javascript">
  var opac = 0.0;
  var alpha = 0;

  function init() {
    var eleme = document.getElementById("forget");
    eleme.style.display = 'inline';
    eleme.style.filter = "alpha(opacity = " + alpha + ")";
    eleme.style.opacity = opac;

    setTimeout("fadein()", 7500);
  }

  function fadein() {
    var eleme = document.getElementById("forget");

    opac = opac + 0.1;
    alpha = parseInt(opac * 100);
    eleme.style.opacity = opac;
    eleme.style.filter = "alpha(opacity = " + alpha + ")";

    if (opac < 1.0) {
      // Change the 50 to adjust the speed. The higher the number, the slower the fade
      setTimeout("fadein()", 30);
    }

  }

  window.onload = init;
</script>
  • 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-14T04:43:35+00:00Added an answer on June 14, 2026 at 4:43 am

    The problem is you can only assign one function to window.onload as a time. The last one will always take precedence over the first ones.

    Instead of using window.onload, you can use window.addEventListener to tell the browser to run your code when the page loads. You can use it like this.

    window.addEventListener('load', function(){
        var eleme = document.getElementById("forget");
        eleme.style.display = 'inline';
        eleme.style.filter = "alpha(opacity = " + alpha + ")";
        eleme.style.opacity = opac;
    
        setTimeout("fadein()", 7500);
    }, false);
    

    You will need to copy and paste this twice, one for “forget” and one for “Verbum”.

    Also, I’d suggest changing the names of your fadein functions, or pass the element to be faded as an argument. Otherwise your code will simply run the last fadein function and either “forget” or “Verbum” will work correctly, and the other will not.

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

Sidebar

Related Questions

Having trouble with proper regex for RewriteCond RewriteCond %{REQUEST_URI} !^/foo/ Works as expected, that
Having trouble installing play! on windows. Following the installation guide on: http://www.playframework.org/documentation/1.2.4/install After installing
Having trouble with pattern and replacement. How can I make the replacement echo a
I have a form on my page that I am having trouble receiving a
I am having trouble avoiding a sporadic crash in my applet that appears to
Ok , I'm having trouble to solve this , I'm a php / C#
I'm having trouble setting up the HTTP Post android app code to upload a
having trouble coming up with search parameters for this issue, so I can't find
I'm having trouble with a piece of script that removes an object X amount
Having trouble finding the first character of Field42 inside xpath, see below. Any suggestions?

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.