The following code is used to show progress of the progress bar for every second
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap progressbar Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid">
<div class="progress">
<div class="progress-bar" id ="progress" role="progressbar" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">
0%
</div>
</div>
<script>
setInterval("repeat()",1000)
function repeat(){
var width=document.getElementById("progress").style.width;
width=width.replace(/[^\w\s]/gi, '');
document.getElementById("progress").style.width=parseInt(width)+1+"%";
if(parseInt(document.getElementById("progress").style.width)>99)
document.getElementById("progress").style.width="0%"
document.getElementById("progress").innerHTML= document.getElementById("progress").style.width;
}
</script>
</div>
</body>
</html>
output
Bootstrap progressbar Example
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap progressbar Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid">
<div class="progress">
<div class="progress-bar" id ="progress" role="progressbar" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">
0%
</div>
</div>
<script>
setInterval("repeat()",1000)
function repeat(){
var width=document.getElementById("progress").style.width;
width=width.replace(/[^\w\s]/gi, '');
document.getElementById("progress").style.width=parseInt(width)+1+"%";
if(parseInt(document.getElementById("progress").style.width)>99)
document.getElementById("progress").style.width="0%"
document.getElementById("progress").innerHTML= document.getElementById("progress").style.width;
}
</script>
</div>
</body>
</html>
output
No comments:
Post a Comment