Any idea why this script doesn't work?
It should work like this:
http://www.ekcsoft.com/coding/js_hideexample.php
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<script><![CDATA[
var hide= true;
function toggleRows(tableId, tag){
tbl = document.getElementById(tableId);
var len = tbl.rows.length;
var vStyle = (hide)? "none":"";
for(i=1 ; i < len; i++){
tbl.rows[i].style.display = vStyle;
}
if(hide)
tag.innerHTML = "<b>Click here to show rows</b>";
else
tag.innerHTML = "<b>Click here to hide rows</b>";
hide= !hide;
}
]]></script>
<body
Try hiding/showing table rows here:
<p onClick='toggleRows("myTable", this)' style='cursor:pointer'><b>Click here to hide rows </b></p>
<table id="myTable" style="width:200px; border: thin solid blue;">
<tbody>
<tr>
<td>
Test cell 1
</td>
<td>
Test cell 2
</td>
</tr>
<tr>
<td>
Test cell 3
</td>
<td>
Test cell 4
</td>
</tr>
<tr>
<td>
Test cell 5
</td>
<td>
Test cell 6
</td>
</tr>
</tbody>
</table>
</body>
</html>