Hi,
I'm trying to write a script where I can click an image to hide a table, then hide the table and change the image. Then if I click the image again, it should show the table and change the image to the initial image. Below is the code I have so far:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
</head>
<body>
<script LANGUAGE="JavaScript">
function showHideTable() {
if (document.getElementById.("showHide").src == "Hide Table.bmp") {
document.getElementById("TableRow").style.display = '';
document.getElementById("showHide").src = "Show Table.bmp";
} else {
document.getElementById("TableRow").style.display = 'none';
document.getElementById("showHide").src = "Hide Table.bmp";
}
}
</script>
<img id="showHide" src="Hide Table.bmp" onclick="showHideTable()">
<table border=1 cellpadding=4 CELLSPACING=0>
<tr>
<td>ROW 2 - HEADER</td>
</tr>
<tbody id="TableRow" style="display:none">
<tr><td colspan="2">ROW 2 SubDATA...</td></tr>
<tr><td colspan="2">ROW 2 SubDATA1...</td></tr>
</tbody>
</table>
</body>
</html>
Thanks,
Ashton.