| Programming C# C++ (7) Delphi (617) Java (8) JavaScript (31) Document (8) Events (8) ExtJS (9) Strings (3) perl (9) php (4) VBScript (1) Visual Basic (1) New related comments Number of comments in the last 48 hours Reload a web page with a javascript function |
Dynamically collapse or expand a section of a web page
(3 votes). Leave comments and/ or rate it.
Question: I want to dynamically collapse or expand a section of a web page. The idea is to show the user a short screen with a few options, and if the user wants to see any detail, then he will click on an "Expand" link and the relevant section will show its details.This should be done in Javascript, with no extra http page views. Answer: The trick is to put the to-be-collapsed sections in DIV tags.The code below has a DIV section named 'tbl' which is initially hidden. Then by clicking on a link it can be expanded or hidden again. Make sure to set the initial style to display:none <div id=tbl name=tbl style="overflow:hidden;display:none">
Comments:
| ||||||||||||||||||