I have what I hope is a simple question.
I found a js that does exactly what I want, except that I want the table 'closed' when the page is loaded, and opened when the +/- is clicked. I'd like this in Java. (assuming that non-java users would see the table 'open/show')
Hope someone can help. Thanks
Here is the script:
function show_hide(tblid, show) {
if (tbl = document.getElementById(tblid)) {
if (null == show) show = tbl.style.display == 'none';
tbl.style.display = (show ? '' : 'none');
}
}
<a href="javascript:void();" onclick="show_hide('exampletbl')">+/-</a>
<table id="exampletbl">
<tbody>
<tr>
<td>row 1</td>
</tr>
<tr>
<td>row 2</td>
</tr>
</tbody>
</table>
<br>
<a href="javascript:void();"
onclick="show_hide('exampletbl2')">+/-</a>
<table id="exampletbl2">
<tbody>
<tr>
<td>row 3</td>
</tr>
<tr>
<td>row 4</td>
</tr>
</tbody>
</table>