468,301 Members | 1,462 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,301 developers. It's quick & easy.

How would I add innerHTML to my expandable content script?

Hello, I found a script for innerHTML, which has a basic expand / collapse function. However, when it comes to table cells … it craps out. I know some form of toggle function needs to be added, something the lines of this

Expand|Select|Wrap|Line Numbers
  1. function toggle(id) { var tr = document.getElementById(id);
  2. if (tr==null) { return; } var bExpand =  tr.style.display == '';
  3. tr.style.display = (bExpand ? 'none' : ''); }
  4. function Toggle_h1() { toggle('row1'); toggle('row2'); }
  5. function Toggle_h2() { toggle('row3'); toggle('row4'); }
  6.  
However, I cannot make the two codes cohere. Here is the innerHTML script

Expand|Select|Wrap|Line Numbers
  1. function toggle(eina,id,show,hide) {
  2. var tvo = document.getElementById( id );
  3. if( eina.innerHTML == hide ) { eina.innerHTML = show;
  4. tvo.style.display = 'none'; } else { eina.innerHTML = hide;
  5. tvo.style.display = 'block'; } }
  6.  
I've tried quite a bit to make them work, however, I cannot make it work. Is it possible to add the toggle table cell function to the innerHTML, or vice-versa
Nov 29 '09 #1
1 1949
Dormilich
8,651 Expert Mod 8TB
the CSS property display (line #2) must have a value ('' is invalid). (I think it has to be "table-row")
Nov 29 '09 #2

Post your reply

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

Similar topics

4 posts views Thread by Doug | last post: by
4 posts views Thread by SimonV | last post: by
17 posts views Thread by PJ | last post: by
1 post views Thread by huzheng001 | last post: by
8 posts views Thread by Pratik Patel | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.