Thread: Dropdown area
View Single Post
Old 05-10-2007, 12:12 PM   #6 (permalink)
Costin Trifan
Meeow!
 
Costin Trifan's Avatar
 
Join Date: 04-13-07
Location: Romania
Posts: 3,235
iTrader: 0 / 0%
Latest Blog:
None

Costin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest order
The CSS style:
Quote:
<style type="text/css" media="screen">

#Image1 { cursor: hand; }

</style>
The script:
Quote:
<script type="text/javascript">

function toggleDisplay(elementID){
var element;
element = document.getElementById(elementID).style;
element.display == 'none' ? element.display = 'block' : element.display='none';
}

</script>
The HTML:

Quote:
<div>
<span>Click the image</span>&nbsp;
<img id="Image1" onclick="toggleDisplay('Table1');" src="images/yourImage.gif" />
</div>
<br />
<table id="Table1" cellpadding="0" cellspacing="0" style="border: solid 1px #000000; display: none;">
<tbody>
<tr>
<td>This is a test</td>
</tr>
<tr>
<td style="height: 200px;">&nbsp;</td>
</tr>
</tbody>
</table>
Plese note:
- you have to set the attribute "display: none" inline; do not set that attribute in a css class because IE7 has a problem with that. The problem is that when you click the image nothing happens That's why you have to set it inline.
- The rest of the styles you want to apply to the table, you can define them in a css class.

hth.

__________________
...to be continued
Costin Trifan is offline   Reply With Quote