C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » JavaScript »

Rgarding hide and view table


Posted Date: 23 Oct 2009      Posted By: vaddesreenivasulu      Member Level: Gold     Points: 1   Responses: 3



how can we hide and view the table in java script?




Responses

Author: Lalji    23 Oct 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

You Can Try this code sample
<script language="javascript">
imageX='plus';
function toggleDisplay(e){
element = document.getElementById(e).style;
if (element.display=='none') {element.display='block';}
else {element.display='none';}
if (imageX=='plus') {document.getElementById('imagePM').src='minus.bmp';}
else {document.getElementById('imagePM').src='plus.bmp';}
}
</script>
<a title="Show Tables" href="javascript:toggleDisplay('table1')"><img border="0" src="plus.bmp" id=imagePM></a>
<table>
<tr>
<td>alway show this table
</td>
</tr>
</table>
<div style="display:none;" id=table1>
<table>
<tr>
<td>table one</td>
</tr>
</table>
</div>



Author: Chandra Shekar.Y    23 Oct 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

Hi

function toggle(btnClicked)
{
var tblObject = document.getElementById('table1');
if(tblObject == null) { return; }
tblObject.style.display = (tblObject.style.display == '') ? 'none' : '';
btnClicked.src = (tblObject.style.display == '') ? 'minus.jpg' : 'plus.jpg';
}

<img border="0" src="plus.jpg" id=imagePM onclick="toggle(this);" style="cursor:pointer">

<table>
<tr>
<td>Default Visble Table
</td>
</tr>
</table>

<table style="display:none;" id=table1>
<tr>
<td>Table Which is hidden</td>
</tr>
</table>



Author: Chandru    23 Oct 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

Just declare runat=server and id's in table tag

in codebehind,
table.style.add("display","none");
table.style.add("display","block");

Chandru
SilverlightScripting.com



Post Reply
You must Sign In to post a response.
Next : Mouseover event code to pause image floating
Previous : Please tell me the sites for java script and jquery,css
Return to Discussion Forum
Post New Message
Category: JavaScript

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use