Ads

Captured Technology - Blog

Collapsing and Expanding HTML Code

When in need of a quick way to expand and collapse HTML code on the client without posting back to the server of your web application, utilize the <div> tag with a style and some Javascript. Start with the style display set to either none or block and then interchange these two setting based upon a hyperlink click event.

<a href="javascript:;" onmousedown="if(document.getElementById('divMessage_1').style.display == 'none')
    { document.getElementById('divMessage_1').style.display = 'block'; }
else{ document.getElementById('divMessage_1').style.display = 'none'; }">Show/Hide</a>
<div id="divMessage_1" style="display:none">             
<p>This is something to show or hide.</p>
</div>

Blog Directory

Latest technology news.
 Patrick Stevens
 554  246482  11/15/2024

Translate

Categories

Blog Calendar