faulker
08-14-2008, 02:50 PM
Ok, so I've been using a script posted by tcadieux to show and hide rows from a table for a few days now. Worked great. I then modified it slightly, changing the + and - to actual header names for the table. Worked wonderfully...until I tested in IE. Doesn't work at all there. In firefox, the below code lets the table expand when I click the header row. In IE, the header row shows the correct cursor, but then you click it, nothing happens. No script errors pop up. I tested the variables (ie, "title") and they come through with the correct names. I went back and tested the original script in IE and it works fine, so I know it's something stupid that I did...
Hyelp!
<SCRIPT LANGUAGE="JavaScript">
function expandcontract(tbodyid,ClickIcon,title) {
if (document.getElementById(ClickIcon).innerHTML == "<i>" + title + " (Click To Expand)</i>"){
document.getElementById(tbodyid).style.display = "";
document.getElementById(ClickIcon).innerHTML = "<i>" + title + " (Click To Close)</i>";
} else {
alert(title);
document.getElementById(tbodyid).style.display = "none";
document.getElementById(ClickIcon).innerHTML = "<i>" + title + " (Click To Expand)</i>";
}}
</SCRIPT>
<table align="center" border="1" cellspacing="0" width="95%" >
<tr>
<td align="center" colspan="4" onclick="expandcontract('Row4','ClickIcon4','Test')" id="ClickIcon4" style="cursor: pointer; cursor: hand;"><i>Test (Click To Expand)</i></td>
</tr>
<tbody id="Row4" style="display:none">
(...more rows here that are hidden...)
</tbody>
</table>
Hyelp!
<SCRIPT LANGUAGE="JavaScript">
function expandcontract(tbodyid,ClickIcon,title) {
if (document.getElementById(ClickIcon).innerHTML == "<i>" + title + " (Click To Expand)</i>"){
document.getElementById(tbodyid).style.display = "";
document.getElementById(ClickIcon).innerHTML = "<i>" + title + " (Click To Close)</i>";
} else {
alert(title);
document.getElementById(tbodyid).style.display = "none";
document.getElementById(ClickIcon).innerHTML = "<i>" + title + " (Click To Expand)</i>";
}}
</SCRIPT>
<table align="center" border="1" cellspacing="0" width="95%" >
<tr>
<td align="center" colspan="4" onclick="expandcontract('Row4','ClickIcon4','Test')" id="ClickIcon4" style="cursor: pointer; cursor: hand;"><i>Test (Click To Expand)</i></td>
</tr>
<tbody id="Row4" style="display:none">
(...more rows here that are hidden...)
</tbody>
</table>