First off this script needs a minor change to work in FF with a DOCTYPE. Here near the end of percent_bar.js, add the red highlighted code:
Code:
function clipid(id,t,r,b,l){
if(ns4){
id.clip.left=l;
id.clip.top=t;
id.clip.right=r;
id.clip.bottom=b;
}else id.style.width=r+'px';
}
progressBarInit();
window.onresize=function(){
if(ns4)setTimeout('history.go(0)' ,400);
}
With that in mind, here is a demo page with an added script that should work out well for you:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>Date Bar - Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<script type="text/javascript" src="percent_bar.js">
/*
Event-based progress bar- By Brian Gosselin at http://scriptasylum.com/bgaudiodr
Featured on DynamicDrive.com
For full source, visit http://www.dynamicdrive.com
*/
</script>
<script type="text/javascript">
var start_date=new Date(2007, 0, 1).getTime();
var total_days=365;
///////////////// Stop Editing /////////////
var d=new Date();
var now=new Date(d.getFullYear(),d.getMonth(),d.getDate()).getTime()
var days_since=Math.round((now-start_date)/(1000*60*60*24));
if(days_since<total_days)
setCount(Math.round(days_since/total_days*100));
else
setCount(100);
</script>
</body>
</html>
Notes: Just set the two red highlighted variables. The start_date is in the form of:
full_year_number, 0_to_11_month_number, date_number
The total_days is the number of days from the start_date that would represent 100% of the time period that you wish graphically measured.
Bookmarks