I am building a web site that tracks government activity. I want to put javascripts on it that will "spit out" updated totals every day, but I do not want to re-write the html all the time. I hope to use a javascript and pull the running total from an array. I think I am close, but I cannot quite get there.
var presDocs03 = new Array();
presDocs03 [0] = 0; //new year's day
presDocs03 [1] = 0;
presDocs03 [2] = 0;
presDocs03 [3] = 0; //saturday
presDocs03 [4] = 0; //sunday
presDocs03 [5] = 1;
presDocs03 [6] = 0;
presDocs03 [7] = 2;
presDocs03 [8] = 0;
presDocs03 [9] = 0;
presDocs03 [10] = 0; //saturday
presDocs03 [11] = 0; //sunday
var totPresDocs03 = 0;
function presDocs03TotPgs() {
for (var i=0; i<presDocs03.length; i++) {
totPresDocs03 += presDocs03[ i ];
}
window.status = "presDocs03TotPgs = "+totPresDocs03;
} commented out until status
var presDocs03 = new Array();
presDocs03 [0] = 0; //new year's day
presDocs03 [1] = 0;
presDocs03 [2] = 0;
presDocs03 [3] = 0; //saturday
presDocs03 [4] = 0; //sunday
presDocs03 [5] = 1;
presDocs03 [6] = 0;
presDocs03 [7] = 2;
presDocs03 [8] = 0;
presDocs03 [9] = 0;
presDocs03 [10] = 0; //saturday
presDocs03 [11] = 0; //sunday
var totPresDocs03 = 0;
function presDocs03TotPgs() {
for (var i=0; i<presDocs03.length; i++) {
totPresDocs03 += presDocs03[ i ];
}
window.status = "presDocs03TotPgs = "+totPresDocs03;
} commented out until status
Code:
The function will be called with
[CODE]<body onLoad=presDocs03TotPgs():></body>
any comments or suggestions appreciated.