-
dynamically hiding/showing specific rows
I've been trying to show and hide rows that are identified by a specific class name. These rows are not contiguous. Is there a way to do this?
here is my code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xslutput method="html" indent="yes" />
<xsl:template match="/database">
<html>
<head>
<title>clients</title>
<script type="text/javascript">
<![CDATA[
function show_hide()
{
var st1;
if(button1.value=="Hide Name")
{
st1="none";
button1.value="Show Name";
}
else
{
st1="block";
button1.value="Hide Name";
}
var tb1 = document.getElementById("main");
var rows = tb1.getElementsByTagName("tr");
for (var row=0; row<rows.length; row++)
{
var cels = rows[row].getElementsByTagName("td");
cels[0].style.display=st1;
}
}
function show_hide_tran()
{
if(button2.value=="Hide Transactions")
{
button2.value="Display Transactions";
}
else
{
button2.value="Hide Transactions";
}
}
]]>
</script>
</head>
<body>
<input type="button" id="button1" value="Hide Name" onClick="show_hide()"/>
<input type="button" id="button2" value="Hide Transactions" onClick="show_hide_tran()"/>
<table id="main" border="3" cellspacing="1" cellpadding="1">
<xsl:apply-templates select="element"/>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="element">
<xsl:apply-templates select="customer" />
<xsl:apply-templates select="transaction" />
</xsl:template>
<xsl:template match="customer">
<tr>
<td><xsl:apply-templates select="name"/></td>
<td><xsl:apply-templates select="order"/></td>
<td><xsl:apply-templates select="price"/></td>
</tr>
</xsl:template>
<xsl:template match="transaction">
<tr>
<td><xsl:apply-templates select="day"/></td>
<td colspan="2"><xsl:apply-templates select="time"/></td>
</tr>
</xsl:template>
</xsl:stylesheet>
-----------------------
In this case, I'm trying to hide rows which match the transaction rule. Is there a way to delete rows by class name? Maybe I can just add the attribute class and identify the rows I want to delete by class name. However, how do delete specified rows by class name?
Any help would be greatly appreciated. Thank you
Renato
-
Do you actually want to delete them or do you just want to hide them? You can do the latter with the style display:none applied to that class.
-
I want to hide them....I did find a solution, however, its different from applying to the class.....how do you do that....with a class name?
Thank you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|