-
Hiding form with PHP
Okay, I have a table which I can hide/unhide by clicking a checkbox. But I want to have the table hidden by default - does anybody know how I can do this?
You may also notice I have my 'add record' button as a table background with the checkbox over the top, just wondering how I could modify this to just use a button?
Code:
<script type="text/javascript">
function showhide(what,obj) {
if(what.checked) {
obj1 = document.getElementById(obj);
obj1.style.display = 'block';
} else {
obj1 = document.getElementById(obj);
obj1.style.display = 'none';
}
}
</script>
Code:
<table border="0" id="table1" width="37" height="37">
<tr>
<td background="image.gif">
<input type="checkbox" onclick="showhide(this, 'txt1');" name="C1" value="ON" /></td>
</tr>
</table>
<table border="1" width="100%" style="border-collapse: collapse" bordercolor="#C0C0C0" id="txt1">
<tr>
<td>
My stuff here
</td>
</tr>
</table>
-
Re: Hiding form with PHP
Use this on the element makes it hidden by default.
Code:
style="display:none;"
Here's the fiddle using jQuery: http://jsfiddle.net/rHaxH/
:wave: