Today, when I was idle, I used Dtree to write the tree structure that I had been trying to write. Although there were a lot of online code, most of them were not clearly explained. So I decided to explain it in detail. Take a look at the specific example: directory structure: (Note: imgdirectory and test.html files must be in the same level directory and named img) (if you do not want to use img as the directory name, go to the dtree on your own. js changes !) The code for test.html is as follows: [html] <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN "" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <Html xmlns =" http://www.w3.org/1999/xhtml "> <Head> <title> js + css implementation tree structure </title> <! -- Css file (* required) --> <link type = "text/css" rel = "Stylesheet" href = "css/dtree.css"/> <! -- Js file (* required) --> <script type = "text/javascript" src = "js/dtree. js "> </script>