I'm creating some show/hide things with html and javascript and I need some help since I don't know anything about javascript.
I found this online:
<head>
<script type="text/javascript">
function showHide(ID){
itemStyle = document.getElementById(ID).style;
itemStyle.display = 'none'.replace(itemStyle.display, '');
}
</script>
</head>
<body>
<table border=4>
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
</thead>
<tbody>
<tr>
<td onclick="showHide('childrenRows1');">Show/Hide More</td>
</tr>
</tbody>
<tbody id="childrenRows1">
<tr>
<td>Child Row</td>
<td> - Child - </td>
</tr>
</tbody>
</body>
which, if you run it, and click on "Show/Hide More" does exactly what I want. However, I want the default to be hide and here, the default is show.
Can anyone help me fix this?
Thanks!
I found this online:
<head>
<script type="text/javascript">
function showHide(ID){
itemStyle = document.getElementById(ID).style;
itemStyle.display = 'none'.replace(itemStyle.display, '');
}
</script>
</head>
<body>
<table border=4>
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
</thead>
<tbody>
<tr>
<td onclick="showHide('childrenRows1');">Show/Hide More</td>
</tr>
</tbody>
<tbody id="childrenRows1">
<tr>
<td>Child Row</td>
<td> - Child - </td>
</tr>
</tbody>
</body>
which, if you run it, and click on "Show/Hide More" does exactly what I want. However, I want the default to be hide and here, the default is show.
Can anyone help me fix this?
Thanks!