I need a code that hides the content when clicked and reveal them on demand using javascript.
This is in webdesigning

anyone to help

Recommended Answers

All 4 Replies

This can achieve by simple java script function:
this is your table having some design:

<table width="291" id="prl" style="display:none">
      <tr>
      <td width="95">message</td>
      <td width="196"><input name="message" type="text" id="message" ></td>
       </tr>
       <tr>
        <td>name</td>
        <td><input name="name" type="text" id="name"></td>
        </tr>
      </table>

This the the link to show or hide your content:

<a href="#" onClick="toggle_it('prl')">show</a>

and also
include this script in your page:

<script language="javascript">
       function toggle_it(itemID){
        // Toggle visibility between none and inline
        if ((document.getElementById(itemID).style.display == 'none'))
        {
   document.getElementById(itemID).style.display = 'inline';
  
      } else {
  document.getElementById(itemID).style.display = 'none';
  
      }
        }
      </script>

thanks checking it out

This can achieve by simple java script function:
this is your table having some design:

<table width="291" id="prl" style="display:none">
      <tr>
      <td width="95">message</td>
      <td width="196"><input name="message" type="text" id="message" ></td>
       </tr>
       <tr>
        <td>name</td>
        <td><input name="name" type="text" id="name"></td>
        </tr>
      </table>

This the the link to show or hide your content:

<a href="#" onClick="toggle_it('prl')">show</a>

and also
include this script in your page:

<script language="javascript">
       function toggle_it(itemID){
        // Toggle visibility between none and inline
        if ((document.getElementById(itemID).style.display == 'none'))
        {
   document.getElementById(itemID).style.display = 'inline';
  
      } else {
  document.getElementById(itemID).style.display = 'none';
  
      }
        }
      </script>

Hi, thanks for your support.
But where i must put this codes ?
Are in a variable ?

Thanks

<table width="291" id="prl" style="display:none">
<tr>
<td width="95">message</td>
<td width="196"><input name="message" type="text" id="message" ></td>
</tr>
<tr>
<td>name</td>
<td><input name="name" type="text" id="name"></td>
</tr>
</table>

Hi, thanks for your support.
But where i must put this codes ?
Are in a variable ?

Thanks

Fine..
no,any where in your html code...means, any where in your page inside html tags...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.