Created
September 3, 2010 07:47
-
-
Save soh335/563564 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var table = document.getElementsByTagName("table"); | |
var array = table[2].children[0].children; | |
var obj = {sum: 0}; | |
for (var i = 0, len = array.length; i < len; i++) { | |
var tr = array[i].children; | |
var clen = tr.length; | |
if (clen == 2) { | |
} else if (clen == 8) { | |
var n = parseFloat(tr[3].innerHTML); | |
var h = tr[2].innerHTML; | |
var y = tr[5].innerHTML + tr[6].innerHTML; | |
if (n > 0) { | |
obj[h] = obj[h] == undefined ? n : obj[h]+n; | |
if (h != "D") { obj.sum += n}; | |
obj[y] = obj[y] == undefined ? n : obj[y]+n; | |
}; | |
} | |
} | |
console.log(obj); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment