Hi all,
JavaScript is not my strong point, but then I'm not sure I'm hitting this from the right direction.
Firstly, I have some XSLT which produces HTML tables with event information in them. I assign a numerical ID to each table which matches the XSL position().
What I want to achieve is to show only the first 10 tables, until the use clicks a 'View More' link then the next 10 tables are shown until the end of the elements.
I'm having a problem from the outset in that the code that I have written is not hiding the tables over 10 and now the page is crashing in what I assume is an endless loop:
Here is the XSLT:
<xsl:for-each select="umbraco.library:GetMedia(1116, 'true')/node">
<xsl:variable name="fileName" select="data [@alias = 'file']" />
<xsl:variable name="tableID" select="position()" />
<table id="{$tableID}">
<tr>
<td class="eventDate">
<xsl:value-of select="data [@alias = 'eventDate']"/></td>
<td><a href="/downloader?file={$fileName}" target="_blank()" class="eventTitle"><xsl:value-of select="data [@alias = 'title']"/></a></td>
</tr>
<tr>
<td> </td>
<td class="newsSubTitle"><xsl:value-of select="data [@alias = 'subTitle']"/></td>
</tr>
<tr>
<td colspan="2">
<img src="images/borders/news_separator.gif" />
</td>
</tr>
</table>
</xsl:for-each>
Here is the JavaScript:
<script type="text/javascript" language="javascript">
$(document).ready(function () {
var rc = $('#eventReportsList table').length;
if(rc > 10) {
var i=0;
for (i=11;i=rc;i++) {
var currElement = '#' + i;
$(currElement).hide();
}
};
alert('Count ' + rc);
});
</script>
Some assistance or pointers in the right direction would be great!
Thanks.