mda2711
10-19-2003, 11:44 AM
I saw an idea on another website and i wan't to incorporate it into mine.
How can I use javascript to control the css "display" attribute and change it from "none" to "block" on a div
Exodious
10-19-2003, 01:24 PM
<script>
function toggleDiv(div)
{
if(div.style.display == "none")
div.style.display = "block";
else
div.style.display = "none";
}
</script>
<body>
<center>
<table cellpadding="3" cellspacing="0" width="300" bgcolor="#cccccc" style="border: thin solid black">
<tr>
<td style="cursor:hand;" onclick="toggleDiv(document.all.testdiv);">
<font face="arial">
To toggle div display, click on this row
</font>
</td>
</tr>
<tr>
<td bgcolor="#dbdbdb">
<div id="testdiv" name="testdiv" style="display:block;">
<font face="arial">
The divs content
</font>
</div>
</td>
</tr>
</table>
</center>
</body>
Simple example for you