JasonHampson
Technical User
I have this piece of JavaScript (Below), which is called from a html page to hide or unhide a row below the one where the script is called from (if that makes sense). I want to adapt the code so it will go through the document and hide/unhide any row that contains a certain value. Is this modification possible?
CODE[
HTML:
<div class="SmallLink">
<xsl:attribute name="onclick">onExpandTable()</xsl:attribute>
<xsl:attribute name="onmouseover">this.className='SmallLinkOver'</xsl:attribute>
<xsl:attribute name="onmouseout">this.className='SmallLink'</xsl:attribute>
[View Links]
</div>
JavaScript:
function reportError(e)
{
if (e instanceof Error)
window.alert("Caught exception : " + e.description);
else
window.alert("Caught exception " + e);
}
function onExpandTable(clickAction)
{
expandTable(window.event.srcElement);
window.event.cancelBubble = true;
window.event.returnValue = false;
}
function expandTable(treeNode, makeVisible)
{
try {
var parentTable = treeNode.parentElement.parentElement.parentElement;
var thisRow = treeNode.parentElement.parentElement.rowIndex;
// If no makeVisible parameter was supplied, toggle visibility
if (makeVisible == null)
makeVisible = (parentTable.rows(thisRow+1).style.display == "none"
;
treeNode.style.color = makeVisible?("DarkBlue"
"Blue"
parentTable.rows(thisRow+1).style.display = (makeVisible)?("inline"
"none"
;
}
catch (e) {
reportError(e);
}
}
CODE[
HTML:
<div class="SmallLink">
<xsl:attribute name="onclick">onExpandTable()</xsl:attribute>
<xsl:attribute name="onmouseover">this.className='SmallLinkOver'</xsl:attribute>
<xsl:attribute name="onmouseout">this.className='SmallLink'</xsl:attribute>
[View Links]
</div>
JavaScript:
function reportError(e)
{
if (e instanceof Error)
window.alert("Caught exception : " + e.description);
else
window.alert("Caught exception " + e);
}
function onExpandTable(clickAction)
{
expandTable(window.event.srcElement);
window.event.cancelBubble = true;
window.event.returnValue = false;
}
function expandTable(treeNode, makeVisible)
{
try {
var parentTable = treeNode.parentElement.parentElement.parentElement;
var thisRow = treeNode.parentElement.parentElement.rowIndex;
// If no makeVisible parameter was supplied, toggle visibility
if (makeVisible == null)
makeVisible = (parentTable.rows(thisRow+1).style.display == "none"
treeNode.style.color = makeVisible?("DarkBlue"
parentTable.rows(thisRow+1).style.display = (makeVisible)?("inline"
}
catch (e) {
reportError(e);
}
}