By the way, that was an HTML file. When I put this in a tiddler, it
didn't work,it just displayed the whole table.
w

On Jan 24, 6:51 pm, whatever <[email protected]> wrote:
> Hi!
> I found a possible solution, however, it is very awkward. The problem
> is, I have about twenty tables and each has a different number of
> sections and cells, so if a table has thirty lines, the code would
> would get very long. This is the code (beware googlewrap):
> <html>
> <script>
> function hideLines(){
> document.getElementById('message').style.display = 'none'; //Hide the
> message
> if((document.getElementById('data1').innerHTML === '')) { //If a cell
> is empty
>         document.getElementById('line1').style.display = 'none'; //Remove the
> line
>  }
> if((document.getElementById('data2').innerHTML === '')) { //If a cell
> is empty
>         document.getElementById('line2').style.display = 'none'; //Remove the
> line
>  }
> if((document.getElementById('data3').innerHTML === '')) { //If a cell
> is empty
>         document.getElementById('line3').style.display = 'none'; //Remove the
> line
>  }
> if((document.getElementById('data4').innerHTML === '')) { //If a cell
> is empty
>         document.getElementById('line4').style.display = 'none'; //Remove the
> line
>  }
> if((document.getElementById('data1').innerHTML === '' &&
> document.getElementById('data2').innerHTML === '')) { //If both cells
> are empty
> document.getElementById('tbody1').style.display = 'none'; //Remove the
> subtitle
>  }
> if((document.getElementById('data3').innerHTML === '' &&
> document.getElementById('data4').innerHTML === '')) { //If both cells
> are empty
> document.getElementById('tbody2').style.display = 'none'; //Remove the
> subtitle
>  }
> if((document.getElementById('data1').innerHTML === '' &&
> document.getElementById('data2').innerHTML === '' &&
> document.getElementById('data3').innerHTML === '' &&
> document.getElementById('data4').innerHTML === '')) {  //If all four
> cells are empty
>         document.getElementById('table').style.display = 'none'; //Remove the
> table
>         document.getElementById('message').style.display = ''; //Display the
> message
>         }}
>
> window.onload = hideLines;
> </script>
> <table id="table" border="1">
> <tr><td colspan="2">Title</td></tr>
> <tbody id="tbody1">
> <tr id="sub1"><td colspan="2">Subtitle1</td></tr>
> <tr id="line1"><td>test1</td><td id="data1">xx</td></tr>
> <tr id="line2"><td>test2</td><td id="data2"></td></tr>
> </tbody>
> <tbody id="tbody2">
> <tr id="sub2"><td colspan="2">Subtitle2</td></tr>
> <tr id="line3"><td>test3</td><td id="data3"></td></tr>
> <tr id="line4"><td>test4</td><td id="data4"></td></tr>
> </tbody>
> <tr><td colspan="2">Footer</td></tr>
> </table>
> <span id="message">No data</span>
> </html>
>
> w
>
> On Jan 24, 6:08 pm, whatever <[email protected]> wrote:
>
> > At the moment, I'd at least like to get that working in an ordinary
> > HTML document. From then on, it shouldn't be difficult to integrate it
> > into the plugin.
>
> > On Jan 24, 2:55 pm, Julian Knight <[email protected]> wrote:
>
> > > Not sure what is happening then because it worked fine for me (I did put 
> > > in
> > > the missing }) when I moved the <script> section outside the HTML section
> > > and IF I had the inline Javascript extension.
>
> > > It would also be possible to achieve without the inline JS extension by
> > > writing  the code into a function in a tiddler tagged with systemConfig
> > > (loaded at document load time) and run from the ViewTemplate.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.

Reply via email to