TreeView is a useful control in Microsoft IE WebControls, which is widely used. As TreeView opens and gatches, the height it actually occupies is also changing, in my project, the height of TreeView Control is required to form a "compact" layout. The implementation method is as follows:
First, modify TreeView.htc
TreeView.htc In http: // localhost / webctrl_client / 1_0 /, add as follows:
This is to pass hidden properties.
Second, define the JavaScript function
function AthosGetTreeViewCompactHeight (TreeviewID) {objTreeview = document.all [TreeviewID]; objTreeviewNode = objTreeview.TreeviewNode; objTreeviewDivs = objTreeviewNode.getElementsByTagName ( "DIV"); iCount = objTreeviewDivs.length; CompactHeight = -1; for (i = 0; i
function AthosFitTreeViewHeight (TreeviewID) {objTreeview = document.all [TreeviewID]; objTreeview.style.height = String (AthosGetTreeViewCompactHeight (TreeviewID)) "px";}
The first function is the actual height of the tree. The second function is to reset the height of the tree control. The parameters are the ID of the tree control.
This allows the height of the tree control.
// AthossMTH copyright, please contact the author.