Unfortunately, the getElementsByClassName method is not working for me; installing the function simply broke my entire script.
On the other hand, I have in fact devised a solution for my problem; which is three-fold.
First, properly targeting the elements within my nested iFrames. After research and much experimentation I've found the correct syntax; or at least a syntax that works for me in my browser.
// This MUST target the contentWindow of the iFrame
var myParentFrame = document.getElementById("parentFrame").contentWindow;
// THEN that content window's document
var myBodyFrame = myParentFrame.document.getElementById("bodyFrame").contentWindow;
// Finally, I grab all TR tags in my table and save them for later...
var myDocument = myBodyFrame.document.getElementsByTagName("tr");
Once that was out of the way, I needed a solution to making identical id tags, which is illegal by standards. My solution is to use regular expressions to generate tags that start with the same string and end with unique identifiers and assign those id's to the TR elements of my table.
// for this, I use an associative array where each pattern looks for the match to BEGIN with a specific string
$patterns = array("DTS" => '/^DTS/', "DCS" => '/^DCS/', "IGT" => '/^[0-9]/');
foreach ($patterns as $prefix => $pattern)
{
// then, when it finds the match, it creates the appropriate id tag
$content.=(preg_match($pattern,$row['serialno']))? 'id="'. $prefix .'-'. $row['tableid'] .'" ' : ' ';
}
Finally, I need my javascript to do the same thing and search each element in my nested iFrame for a match to that pattern. To do this, I define the RegExp object using data passed from the function call (such as "DTS"). Then check each TR element that I gathered earlier for the pattern using the RegExp.text() method.
// pass function arguement to RegExp object
var myRegExp = new RegExp(regexp);
// loop through each tr element
for (var i = 0; i < myDocument.length; i++)
{
if (myRegExp.test(myDocument[i].id) == true)
{
myDocument[i].style.display = toggle;
}
}