473,785 Members | 3,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can i hide the columns whith JavaScript without bugs

4 New Member
http://www.fiendish.demon.co.uk/html...tablecols.html
This example is exactly what i need, but it's have a bug when using Opera (9.25 on my computer)
Does anybody now some other code like that?
Mar 4 '08 #1
5 1295
greendoc
4 New Member
YAHOO ! Just need to replacing 'block' by ''
Now i search the way to do this without named element..
Mar 4 '08 #2
greendoc
4 New Member
The problem is solved
Mar 4 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
Can you share the final solution for the benefit of others? Thanks!
Mar 4 '08 #4
greendoc
4 New Member
Can you share the final solution for the benefit of others? Thanks!
Shure.. the code is:
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Show/Hide columns for Ciklum CRM</title>
  6. <script language="javascript">
  7.   function show_hide_column(btn,col_no) {
  8.     btn   = document.forms['tcol'].elements[btn];
  9.     stl = btn.checked ? '' : 'none';
  10.     var tbl  = document.getElementById('table_id');
  11.     var rows = tbl.getElementsByTagName('tr');
  12.  
  13.     for (var row=0; row<rows.length;row++) {
  14.       var cels = rows[row].getElementsByTagName('td');
  15.       cels[col_no-1].style.display=stl;
  16.     }
  17.   }
  18. </script>
  19. </head>
  20.  
  21. <body>
  22. <table id="table_id" width="100%" border=1>
  23. <tr>
  24. <td bgcolor="#666666" class="bold">column 1 text</td>
  25. <td bgcolor="#99FF00">column 2 text</td>
  26. <td bgcolor="#CC6633" class="italic">column 3 text</td>
  27. <td bgcolor="#FFFF33">column 4 text</td>
  28. </tr>
  29. <tr>
  30. <td bgcolor="#666666" class="bold">column 1 text</td>
  31. <td bgcolor="#99FF00">column 2 text</td>
  32. <td bgcolor="#CC6633" class="italic">column 3 text</td>
  33. <td bgcolor="#FFFF33">column 4 text</td>
  34. </tr>
  35. <tr>
  36. <td bgcolor="#666666" class="bold">column 1 text</td>
  37. <td bgcolor="#99FF00">column 2 text</td>
  38. <td bgcolor="#CC6633" class="italic">column 3 text</td>
  39. <td bgcolor="#FFFF33">column 4 text</td>
  40. </tr>
  41. </table>
  42. <p>&nbsp;</p>
  43. <p>&nbsp;</p>
  44. <form name="tcol" onsubmit="return false">
  45. Hide/Show columns
  46. <input type=checkbox name="col1" onclick="show_hide_column(this.name,1)" checked> 1
  47. <input type=checkbox name="col2" onclick="show_hide_column(this.name,2)" checked> 2
  48. <input type=checkbox name="col3" onclick="show_hide_column(this.name,3)" checked> 3
  49. <input type=checkbox name="col4" onclick="show_hide_column(this.name,4)" checked> 4
  50. </form>
  51. </body>
  52. </html>
  53.  
  54.  
Mar 11 '08 #5
acoder
16,027 Recognized Expert Moderator MVP
Thanks for posting.
Mar 11 '08 #6

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

Similar topics

6
11488
by: adrien | last post by:
Hi, (also posted in netscape.public.mozilla.browser) i use netscape 7 and want to hide the scrollbars of the window when something happens. I tried this: window.scrollbars.visible=false window.scrollbars.visibility="no" .... nothing works Is it also possible only to hide the vertical scrollbar instead of both?
7
29154
by: FP | last post by:
I'm new to Java Script. I'm displaying comments people have made. Below each persons' comment I want to add 2 buttons "Reply" and "Amend". Clicking "Reply" would display an empty text field below the comment with a spell check & submit button. Clicking "Amend" would display the same buttons & text field but pre-populated with the original comment. Using Java Script how do I show / hide the text field in my list of comments but have...
2
8067
by: bela.patkai | last post by:
I have a css tabbed text menu (Home - Services - About - Contact) and would like to show appropriate text formatted in <divblocks on the webpage when clicking on the menu. Is it possible to do without javascript? I was experimenting for a day, but found no solution. So far it seems the only way is to use js to hide/show <divblocks with an ID. many thanks, Bela
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10091
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3646
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.