[Question] I made a function to traverse Tree nodes using JS, and then I found a problem!

Source: Internet
Author: User
My tree is generated by reading data from the database.
It is found that all nodes can be traversed only when all nodes are expanded. Otherwise, an error is reported and you do not know if it is a bug.

function getv1 (node)
{document. all ("hidden1 "). value = "";
var nodearray = new array ();
nodearray = node. getchildren ();
If (parseint (nodearray. length )! = 0)
{< br> for (VAR I = 0; I {< br> var cNode = nodearray [I];
// alert (cNode. getattribute ("text");
getv1 (cNode);
}< BR >}< br> else
{< br> If (node. getattribute ("checked") = true)
{< br> document. all ("hidden1 "). value = document. all ("hidden1 "). value + node. getattribute ("ID") + "#";
}< BR >}< br> // alert (document. all ("hidden1 "). value);
}

< Body ms_positioning = " Gridlayout " >
< Form ID = " Form1 " Method = " Post " Runat = " Server " >
< Iewc: Treeview ID = " Treeview1 " Style = " Z-INDEX: 101; left: 8px; position: absolute; top: 8px " Runat = " Server " > </ Iewc: Treeview > < Input ID = " Hidden1 " Style = " Z-INDEX: 102; left: 296px; position: absolute; top: 296px " Type = " Hidden"
Name = " Hidden1 " Runat = " Server " >
< ASP: button ID = " Button1 " Style = " Z-INDEX: 103; left: 456px; position: absolute; top: 464px " Runat = " Server"
Text = " Display " > </ ASP: button > </ Form >
< Script >
Getv1 (treeview1 );
</ Script >
</ Body >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.