Results 1 to 2 of 2

Thread: Hiding form with PHP

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    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 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    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 FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

Posting Permissions

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



Click Here to Expand Forum to Full Width