A few things I had to change to get it to work
First in the head element, I moved the onload from an attribute in the body tag to
window.onload = startbar;
since I hear that is the way it should be done nowadays. Then setTimeout takes a function as the first parameter, not a string with the function name in it. Next I had to put a closing </script> tag. Last I added a check so the bar would stop updating when it was at progress zero.
In body element, I moved the divs out of each other so I could set the same coordinates for them. Also I found I had to put a in them to get the color to show (there may be other ways). And because of this, again in the head element, I had to make the display="none" when it was down to zero width.
I think those were all the changes I made. Anyway, here is the code with changes. It seems to work in FF1.5 and IE7.
Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Progress Bar</title>
<style type="text/css">
#outertimebar { background-color:red; position:absolute; left:40; top:100; width:100; }
#innertimebar { background-color:green; position:absolute; left:40; top:100; width:100; }
</style>
<script type="text/javascript">
var progress=100;
function progressbar(){
progress=progress-10;
if (progress == 0) {
document.getElementById('innertimebar').style.display = "none";
}
document.getElementById('innertimebar').style.width=progress+"px";
if (progress > 0) {
startbar();
}
}
function startbar(){
t=setTimeout(progressbar,500)
}
window.onload = startbar;
</script>
</head>
<body>
<div id="outertimebar"> </div>
<div id="innertimebar"> </div>
</body>
</html>
Good luck.
david_kw