By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,694 Members | 1,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,694 IT Pros & Developers. It's quick & easy.

uncheck check box, hide table in asp

P: 4
i had 2 tables in a form an di want to hide one of the table. And only if i tick the chech box, the below table should be displayed or else it should be i hidden mode.
kindly hep me . Thanks in advance.
Jan 28 '08 #1
Share this Question
Share on Google+
6 Replies


P: 4
In ASP programming i had 2 tables in a form and i want to hide one of the table. And only if i tick the check box, the below table should be displayed or else it should be in hidden mode.
kindly help me . Thanks in advance.
Jan 28 '08 #2

P: 19
i hope this will work for u satish

Expand|Select|Wrap|Line Numbers
  1. <body>
  2. <form>
  3.       <input type=checkbox onclick="hideTable()" id=chk name=chk />
  4.       <br />
  5.       <table id=Table1 border="1" cellspacing="2" cellpadding="2" bordercolor="Purple" >
  6.             <tr>
  7.                 <td>ok1
  8.                 </td>
  9.                 <td>ok2
  10.                 </td>
  11.             </tr>
  12.         </table>
  13.         <br /><br />
  14.         <table border="1" cellspacing="2" cellpadding="2" bordercolor="Purple" >
  15.             <tr>
  16.                 <td>ok3
  17.                 </td>
  18.                 <td>ok4
  19.                 </td>
  20.             </tr>
  21.         </table>
  22. </form>     
  23. </body>
  24. <script>
  25. function hideTable()
  26. {
  27. if (document.getElementById("chk").checked==true)
  28. {document.getElementById("Table1").style.display="none"}
  29. else
  30. {document.getElementById("Table1").style.display="inline"}
  31. }
  32. </script>
  33.  
let me know if doest not work

bye

Rahul
Jan 28 '08 #3

CroCrew
Expert 100+
P: 563
Give this a try code a try.

Hope it helps~

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.         <title>Example</title>
  4.         <script type="text/javascript">
  5.             function applyDisplay(CheckBoxNumber)
  6.             {
  7.                 if (document.getElementById('CheckBox'+CheckBoxNumber).checked)
  8.                 {
  9.                     document.getElementById('Table'+CheckBoxNumber).style.display = '';
  10.                 }
  11.                 else
  12.                 {
  13.                     document.getElementById('Table'+CheckBoxNumber).style.display = 'none';
  14.                 }
  15.             }
  16.         </script>
  17.     </head>
  18.     <body>
  19.         <form method="post" action="#" name="xForm" id="xForm">
  20.             <input type="checkbox" name="CheckBox1" onclick="applyDisplay(1);"> Check to see table 1.
  21.             <table border="1" id="Table1" style="display: none;">
  22.                 <tr><td>Row 1</td></tr>
  23.                 <tr><td>Row 2</td></tr>
  24.                 <tr><td>Row 3</td></tr>
  25.             </table>
  26.             <br>
  27.             <input type="checkbox" name="CheckBox2" onclick="applyDisplay(2);"> Check to see table 2.
  28.             <table border="1" id="Table2" style="display: none;">
  29.                 <tr><td>Row 1</td></tr>
  30.                 <tr><td>Row 2</td></tr>
  31.                 <tr><td>Row 3</td></tr>
  32.             </table>
  33.         </form>
  34.     </body>
  35. </html>
  36.  
  37.  
Jan 28 '08 #4

CroCrew
Expert 100+
P: 563
Hey Satishkatarapu,

I think you were having problems posting your question because I see that you have posted the same question more then one time. Your answer can be found here: http://www.thescripts.com/forum/thread764229.html

Can the moderators remove the other duplicate questions please?
Jan 28 '08 #5

jhardman
Expert 2.5K+
P: 3,405
In ASP programming i had 2 tables in a form and i want to hide one of the table. And only if i tick the check box, the below table should be displayed or else it should be in hidden mode.
kindly help me . Thanks in advance.
Satish,

Please don't double-post your questions.

Jared, moderator
ASP forum
Jan 30 '08 #6

P: 1
Despite the multiple posts this one helped me a bunch. It was exactly what I needed to do.

Thanks guys!
Feb 19 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.