How would I add innerHTML to my expandable content script?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • IntoEternity
    New Member
    • Nov 2009
    • 1

    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

    Code:
    function toggle(id) { var tr = document.getElementById(id);
    if (tr==null) { return; } var bExpand =  tr.style.display == '';
    tr.style.display = (bExpand ? 'none' : ''); }
    function Toggle_h1() { toggle('row1'); toggle('row2'); }
    function Toggle_h2() { toggle('row3'); toggle('row4'); }
    However, I cannot make the two codes cohere. Here is the innerHTML script

    Code:
    function toggle(eina,id,show,hide) {
    var tvo = document.getElementById( id );
    if( eina.innerHTML == hide ) { eina.innerHTML = show;
    tvo.style.display = 'none'; } else { eina.innerHTML = hide;
    tvo.style.display = 'block'; } }
    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
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    the CSS property display (line #2) must have a value ('' is invalid). (I think it has to be "table-row")

    Comment

    Working...