I forgot you needed that to be set by time of day each time.
Here is the script :
Just set "dailyamount" to the dollar amount you want total for the day.
I have it set to 500 dollars a day now in the script :
Quote:
<html>
<head>
<script type="text/javascript">
dailyamount = 500; // daily dollar amount. example 5 will equal 5 dollars per day
// edit above only
dailyamount=dailyamount*100;
var cents=0;
var dollars=0;
function startTime()
{
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
dec=0;
outx=new Array();
var xx = new Array();
h=h*3600;
m=m*60
tt = m+h+s;
tt = Math.floor(dailyamount/86400 * tt);
tt+="";
xx = tt.split("");
xx = xx.reverse();
for (i=0;i<xx.length;i++) {
if ((i>1) && (dec==0) ){dec=1; outx.push(".");}
outx.push(xx[i]);
}
outx=outx.reverse();
money = outx.join("");
if (xx.length == 1) {money = "0.0" + money}
if (xx.length == 2) {money = "0." + money}
var updatesecs = 1000;
var strcents = 0;
document.getElementById('txt').innerHTML= "We have made "+ money + " today!";
t=setTimeout('startTime()',updatesecs);//time in milliseconds for the total to be updated
}
</script>
</head>
<body onload="startTime()">
<div id="txt">If you can read this something went wrong.</div>
</body>
</html>
|