you can't make a "progress bar" with CSS only (well not one you can animate anyway)
So a bit of DHTML playing gets this
HTML Code:
function progressBar(iWidth,iHeight,iDone) {
if (iWidth != 0) {
document.getElementById("progress").style.width = iWidth +"px";
} else {
document.getElementById("progress").style.width = 200 +"px";
}
if (iHeight != 0) {
document.getElementById("progress").style.height = iHeight +"px";
document.getElementById("progress_done").style.height = iHeight +"px";
document.getElementById("progress_todo").style.height = iHeight +"px";
} else {
document.getElementById("progress").style.height = 20 +"px";
document.getElementById("progress_done").style.height = 20 +"px";
document.getElementById("progress_todo").style.height = 20 +"px";
}
document.getElementById("progress_done").innerHTML = iDone +"%";
document.getElementById("progress_done").style.backgroundColor = "green";
document.getElementById("progress_done").style.width = iDone +"%";
document.getElementById("progress_todo").style.backgroundColor = "yellow";
document.getElementById("progress_todo").style.width = (100 - iDone) +"%";
if (iDone != 100) {
document.getElementById("progress_todo").innerHTML = " "
}
}
function use is progressBar(width,height,amount-done)
Demo code:
HTML Code:
<a href="javascript:progressBar(500,50,50)">50% Progress</a>
<br>
<a href="javascript:progressBar(0,0,25)">25% Progress</a>
<br>
<a href="javascript:progressBar(0,0,30)">30% Progress</a>
<br>
<a href="javascript:progressBar(0,0,75)">75% Progress</a>
<br>
<a href="javascript:progressBar(0,0,80)">80% Progress</a>
<br>
<a href="javascript:progressBar(0,0,100)">100% Progress</a>
<br>
<div id="progress"><div id="progress_done"></div><div id="progress_todo"></div></div>
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
|