Forum Moderators: open

Message Too Old, No Replies

Style Sheet

Hide and Show Tables Through StyleSheet

         

Leo2005

9:43 am on Jul 19, 2005 (gmt 0)



Hi,

I have an ASP page which generates multiple tables dynamically.I have assigned unique id and name to each table through script.

How can I write a javascript to show and hide each table by clicking a hyperlink against each table by using javascript and Style Sheet?

I used the following code for it :
<script>
function showhideTab(Id){
document.all.Tbl_1.style.display = 'none' ;
//document.all.Tbl_[Id].style.display = 'none' ;
}
</script>

Where Tbl_1 is the id and name of first table.

But when I use Id variable (written in comments) it gives me script error.

Can anyone help me to fix the error so that I can show and hide each table by just sending the Id of it?

Thank you in advance.

Rambo Tribble

12:50 pm on Jul 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



document.all is ancient, IE-only syntax. Try:

document.getElementById(Id).style.display="none";