<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
function reset_table(element){
element.html('Read Description');
element.removeClass('showing');
element.removeClass('link_on');
$("#main_td").removeClass('main_td');
element.parent().removeClass('link_on');
$("#div_"+element.attr('id')).hide();
}
$(document).ready(function(){
$('.link_class').click(function(){
if($(this).hasClass('showing')){
reset_table($(this));
}else{
$(".td_class").each(function(){
$(this).removeClass('link_on');
$(this).children().html('Read Description');
});
div_id = 'div_'+$(this).attr('id');
$(this).parent().addClass('link_on');
$(this).html('Hide Description');
$(".div_class").each(function(){
$(this).css('display','none');
});
$(".link_class").each(function(){
$(this).removeClass('showing');
})
$(this).addClass('showing');
$("#"+div_id).show();
$("#main_td").addClass('main_td');
}
});
});
</script>
<style>
.link_on{
background-color:#CCC;
}
.div_class{
background-color:#CCC;
height:100%;
width:100%;
}
.main_td{
background-color:#CCC;
}
.td_class{
height:30px;
}
</style>
<table width="500" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="166" class="td_class">
<a href="#" class="link_class" id="1">Read Description</a></td>
<td width="327" rowspan="6" valign="top" id="main_td">
<div id="div_1" style="display:none;" class="div_class">content for div 1</div>
<div id="div_2" style="display:none;" class="div_class">content for div 2</div>
<div id="div_3" style="display:none;" class="div_class">content for div 3</div>
<div id="div_4" style="display:none;" class="div_class">content for div 4</div>
<div id="div_5" style="display:none;" class="div_class">content for div 5</div>
<div id="div_6" style="display:none;" class="div_class">content for div 6</div>
</td>
</tr>
<tr>
<td class="td_class"><a href="#" class="link_class" id="2">Read Description</a></td>
</tr>
<tr>
<td class="td_class"><a href="#" class="link_class" id="3">Read Description</a></td>
</tr>
<tr>
<td class="td_class"><a href="#" class="link_class" id="4">Read Description</a></td>
</tr>
<tr>
<td class="td_class"><a href="#" class="link_class" id="5">Read Description</a></td>
</tr>
<tr>
<td class="td_class"><a href="#" class="link_class" id="6">Read Description</a></td>
</tr>
</table>
<br>
<br>
|