Rdogg
01-26-2009, 11:47 PM
i made a javascript progressbar
and it moves and stuff heres my .js code not my html
function initialize() {
divId = 'sample';
thedivId = document.getElementById(divId);
var percentage = thedivId.innerHTML;
//Set the Progress Bar color
thedivId.style.backgroundColor="#00FF00";
brim(divId,0,parseInt(percentage.substr(0, percentage.length-1)));
}
function brim(Id,start,percentage) {
if (document.getElementById) {
o = document.getElementById(Id);
if (start <= percentage) {
setWidth(o, start);
start += 1;
//Show progression percentage near the progress bar
document.getElementById('percentage').innerHTML = (start -1) + "%";
window.setTimeout("brim('"+Id+"',"+start+","+percentage+")", 50);
}
}
}
function setWidth(o, start) {
o.style.width = start+"%";
}
how can i make it rederict when it reaches 100%
and it moves and stuff heres my .js code not my html
function initialize() {
divId = 'sample';
thedivId = document.getElementById(divId);
var percentage = thedivId.innerHTML;
//Set the Progress Bar color
thedivId.style.backgroundColor="#00FF00";
brim(divId,0,parseInt(percentage.substr(0, percentage.length-1)));
}
function brim(Id,start,percentage) {
if (document.getElementById) {
o = document.getElementById(Id);
if (start <= percentage) {
setWidth(o, start);
start += 1;
//Show progression percentage near the progress bar
document.getElementById('percentage').innerHTML = (start -1) + "%";
window.setTimeout("brim('"+Id+"',"+start+","+percentage+")", 50);
}
}
}
function setWidth(o, start) {
o.style.width = start+"%";
}
how can i make it rederict when it reaches 100%