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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:52:56+00:00 2026-06-08T00:52:56+00:00

I do not know anything in Javascript (I have copied a code for a

  • 0

I do not know anything in Javascript (I have copied a code for a progress bar but it does not display the percentage). I just need to display the text value of the actual % inside my progress bar (a text such as : 1%, 2%, 3%…).

The existing code I have is the following (I do not care about the style, so I removed it to read the code easier) :

<div id="loading">
<div id="progressbar">
<div id="progress"/>

<script>
 var loading = document.getElementById('loading');
 var progress = document.getElementById('progress');
 var progressbar = document.getElementById('progressbar');

 function updateProgress() 
 {
   if (loading.style.display !== 'none')
   {
       var width = parseInt(progress.offsetWidth + ((progressbar.offsetWidth - progress.offsetWidth) * .15));

       if (width > (progressbar.offsetWidth * .95))
        width = parseInt(progressbar.offsetWidth) * .5;

       progress.style.width = width + 'px';
       window.setTimeout("updateProgress()", 1000);
    }
  }
 document.body.style.margin = 0;
 document.body.style.padding = 0;
 loading.style.display = 'block';
 updateProgress();
 </script>
</div>
</div>

Can you help me to add the missing code to display a text having the percentage already loaded please ?

  • 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-08T00:52:58+00:00Added an answer on June 8, 2026 at 12:52 am

    https://developer.mozilla.org/en/DOM/element.innerHTML — this is the element property to set the content of an element.

    Assuming your progress percentage is defined as var percent, you’ll just need to set the content as such:

    progress.innerHTML = percent.toFixed(1) + '%';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ExtJS have adapter for working with other javascript libraries. But why? Why not just
I know this is a recurrent/classical topic but I did not found anything that
I do not know javascript right now but I am planning on learning it.
I know it's not optimal, but I have to work with it, a page
I hope I'm not creating a duplicate here, but I just don't really know
I know questions around javascript compression have been asked multiple times but I cannot
I know this is so basic, but for some reason it's just not doing
I'm trying to write a REST API. I honestly do not know anything related
I am not a DBA and so dont really know anything about SQL 2005
I have a json file and I assume that I do not know anyting

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.