CheckBox OnClick Hide/Show HTML Table

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="HideShow.aspx.cs"
Inherits="HideShow" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

<script type="text/javascript">
function ShowHide(obj)
               {
                   if(!obj.checked) {
                     document.getElementById('tbl_QuestionTags_Software').style.display = 'none';
                     document.getElementById('tbl_QuestionTags_Software').style.visibility="hidden";
                     }
                    else {
                    document.getElementById('tbl_QuestionTags_Software').style.display = '';
                    document.getElementById('tbl_QuestionTags_Software').style.visibility ="visible";
                   }
               }


</script>

<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
   <div>
       <asp:CheckBox ID="chk_QuestionTags_Software" runat="server" CssClass="text" Text="Software"
           onclick="ShowHide(chk_QuestionTags_Software)" />
       <table id="tbl_QuestionTags_Software" border="1" bordercolor="red" cellpadding="0"
           cellspacing="0" style="width: 100%">
           <tr>
               <td>
                   Test1</td>
               <td>
                   Test1</td>
               <td>
                   Test1</td>
               <td>
                   Test1</td>
               <td>
                   Test1</td>
           </tr>
       </table>
   </div>
</form>
</body>
</html>

No comments:

Post a Comment