I have a javascript function (function toggleTree(theRow) ) where the row is passed to this function from a cell in a table onclick.
<tr class="rowWhite"><td style="text-align:center"><img class="expand" alt="" src="images/plus.jpg"onclick="toggleTree(this.parentNode.parentNode);" />
Toggle tree function is below.
function toggleTree(theRow)
{
var imgEl = theRow.cells[0].firstChild;
if (theRow.cells[0].firstChild.className == "expand")
{
theRow.cells[0].firstChild.className="collapse";
theRow.cells[0].firstChild.src="images/minus.jpg";
alert(theRow.cells[0].firstChild.className);
alert(theRow.cells[0].firstChild.src);
return "expand";
}
else
{
theRow.cells[0].firstChild.className="expand";
theRow.cells[0].firstChild.src="images/plus.jpg";
alert(theRow.cells[0].firstChild.className);
alert(theRow.cells[0].firstChild.src);
return "collapse";
}
}
The values of theRow.cells[0].firstChild.className and theRow.cells[0].firstChild.src are different in IE and Firefox due to which, the function does not work in FF but it works in IE. How do i get the values into the jsfunction from any browser?