By trial and error you might eventually get what you want, or not. There are various ways. Here's what I did - first I got rid of all that were like (highlighted):
Code:
<th scope="row" class="auto">L20</th>
So that all of the th tags with the class auto were empty.
Next I changed:
Code:
<script type="text/javascript">
function doSomething(row){
var kids = row.childNodes;
for(var i = 0; i < kids.length; ++i){
if(kids[i].tagName && kids[i].tagName.toLowerCase() === 'th' && kids[i].className === 'auto'){
kids[i].insertBefore(document.createTextNode('L' + (i + 1) + ': '), kids[i].firstChild);
break;
}
}
}
var trs = document.getElementsByTagName('th');
for(var i = 0; i < trs.length; ++i){
doSomething(trs[i]);
}
</script>
to:
Code:
<script type="text/javascript">
(function(){
var thNum = 0;
function doSomething(th){
if(th.className === 'auto'){
th.insertBefore(document.createTextNode('L' + (++thNum) + ': '), th.firstChild);
}
}
function getThs(){
var ths = document.getElementsByTagName('th');
for(var i = 0; i < ths.length; ++i){
doSomething(ths[i]);
}
}
if (window.addEventListener){
window.addEventListener('load', getThs, false);
}
else if (window.attachEvent){
window.attachEvent('onload', getThs);
}
})();
</script>
That seemed to do it. I'm not clear though on whether or not this is what you want, or if it is, why. It seems to me that the numbers would then change according to however many th tags you had with the class auto. And though it might look nice, these numbers wouldn't signify much of anything that's useful. That is to say that the only reason I can think of for doing it this way would be to accommodate a changing number of tags that qualify. But as the number of tags changes, especially if one is removed or inserted other than at the end, the numbers would change as well, so wouldn't from change to change necessarily point to anything in particular.
Another consideration is that, for folks with javascript disabled or unavailable, there will be no numbers.
But I may have missed the real point of this.
Bookmarks