Show/Hide Div

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ansuiya
    New Member
    • Jan 2007
    • 40

    #16
    ok wait..

    jus chk this out.. http://www.netlobo.com/div_hiding.html

    i wanted this kind of output.. the code is given but that is bit complex..

    Comment

    • Nert
      New Member
      • Nov 2006
      • 64

      #17
      Originally posted by Ansuiya
      ok wait..

      jus chk this out.. http://www.netlobo.com/div_hiding.html

      i wanted this kind of output.. the code is given but that is bit complex..
      now i got what you really wanted to do..,
      here try this code i just made the code from the site you gave a bit smaller and easy to understand.

      Code:
      <script language='javascript1.2'>
      function showdiv(show){	
      	var obj = document.getElementById(show).style;
      	if(!obj.display)
      		obj.display = 'none';
      	else
      		obj.display = '';		
      }
      </script>
      you can make your own html code or just try this one to test whether it is working.
      HTML:
      Code:
      <body>
      	<p>
      		Do not link to other websites for promoting/traffic generation. Only link to helpful resources
      		<a href="javascript:showdiv('demodiv');">  Add a Comment</a>	
      	<div id="demodiv" >
      		Do not link to other websites for promoting/traffic generation. Only link to helpful resources
      	</div>	
      	<input type="text" runat="server" id="tbSearch" /> 
      	</p>
      </body>

      Comment

      • Ansuiya
        New Member
        • Jan 2007
        • 40

        #18
        hey nert thanx 4 the help 1 more thing left plz do it.. actualy after clicking it shud show the div.actually it is showing when the page loads.It shud b hidden on page load ,after clicking it shud b visible..

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #19
          Use
          [HTML]<div id="demodiv" style="display: none;">[/HTML]

          Comment

          • Ansuiya
            New Member
            • Jan 2007
            • 40

            #20
            Now the problem is solved.Thank u ALL............ ............

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #21
              No problem, you're welcome. A special thanks to Nert for solving most of your problem.

              Comment

              Working...