Results 1 to 2 of 2

Thread: Hiding form with PHP

  1. #1
    Addicted Member
    Join Date
    May 06
    Posts
    137

    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>

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 08
    Location
    Trivandrum, Kerala, India
    Posts
    7,559

    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/

    Last edited by akhileshbc; Jun 10th, 2012 at 12:06 PM. Reason: corrected grammar

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD Athlon X2 5200+, ASUS Motherboard, 2 GB RAM, 400 GB HDD, Nvidia 8600 GT 512MB, 19.5" TFT(Wide), Creative 5.1 Home Theater

    Social Group: VBForums - Developers from India

    Skills: PHP, MySQL, jQuery, VB.Net, VB6, Photoshop...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •