Looping Through TD Tags on Proboards

This tutorial will teach you how to target cells on Proboards forums, and will help on other forums and websites as well. First, let me put up a small code.

<script type = "text/javascript"> 
var td = document.getElementsByTagName('TD'); 
for(t=0;t<td.length;t++){ 
    if(td[t].width == "1%" && td[t].align == "center" && td[t].className == "titlebg" && td[t].innerHTML.match(/Topics/i)){ 
        td[t-1].innerHTML="FORUM NAME HERE";
    }
} 
</script>

Let's go through this code, line by line. First we start the code with <script type = "text/javascript"> obviously. Next line: var td = document.getElementsByTagName('TD'); sets up a Variable named "td" and assigns it to an element 'TD' which means a table cell. Basically now, evertime we bring up 'td' it will refer to a table cell. The next line for(t=0;t<td.length;t++){ first makes a variable, "t" then it gives it a value of 0. Then it says if it's lower than the value of "td" keep increasing it.

Just to make it easier, it's going to loop through all the table cells on the page. note the "{" this means anything { between } will happen IF for(t=0;t<td.length;t++) is done, which it automatically will be. But no need to worry about that. Next line: if(td[t].width == "1%" && td[t].align == "center" && td[t].className == "titlebg" && td[t].innerHTML.match(/Topics/i)){ This is describing what table cell we're trying to grab. In this case it's the Title Bar of a proboards forum. First, it says it's width is 1% then it says it's aligned to teh center, then it says it's class is titlebg, then it says the name is topics. Then the next line says td[t-1].innerHTML="FORUM NAME HERE"

Basically, since in the previous line we described what the variable "td" looks like, here we are saying, replace the table cell right before the cell 'td' is assigned to, and replace it with "FORUM NAME HERE". So, it says td[t-1], that means the variable td meaning the cell, and the variable t, meaning the whole description above. It's a little hard to understand, but still good for makin simple codes. Really easy, and when making Proboards Hacks, EXTREMELY usefull. Hope this helped. If you have any questions, please PM Me. Regards Nemo™