Click here to Skip to main content
Click here to Skip to main content
Go to top

HTML 5 Progress Bar For Progressive JavaScript Events Processing

, 4 Dec 2012
Rate this:
Please Sign up or sign in to vote.
Try this block of HTML 5 code

Create a new HTML file and copy the following code to see the result in your browser 

<html>
 <title>HTML 5 Progress Bar For Progressive Javascript Events Processing</title>
 <body>
<progress id="progressBar" value="0" max="100" style="width:300px;"></progress>
<span id="status"></span>
<h1 id="finalMessage"></h1>
<script type="text/javascript" language="javascript">
function progressBarSim(al) {
  var bar = document.getElementById('progressBar');
  var status = document.getElementById('status');
  status.innerHTML = al+"%";
  bar.value = al;
  al++;
	var sim = setTimeout("progressBarSim("+al+")",300);
	if(al == 100){
	  status.innerHTML = "100%";
	  bar.value = 100;
	  clearTimeout(sim);
	  var finalMessage = document.getElementById('finalMessage');
	  finalMessage.innerHTML = "Process is complete";
	}
}
var amountLoaded = 0;
progressBarSim(amountLoaded);
</script>
</body> 
</html>     

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

No Biography provided

Comments and Discussions

 
GeneralMy vote of 5 PinmemberNitesh Maharaj4-Dec-12 21:48 
SuggestionStuff I had to do to get it to work PinmemberNathaniel A Collier4-Dec-12 6:45 
GeneralRe: Stuff I had to do to get it to work Pinmemberemad_hawaree4-Dec-12 21:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140921.1 | Last Updated 4 Dec 2012
Article Copyright 2012 by Emad Al Hawary
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid