0

我正在尝试在网页中获取树视图。我正在为树视图使用 jstree 插件。我实际上是 jQuery 的新手。以下是我编写的代码。

<%-- 
    Document   : folderView
    Created on : Nov 2, 2010, 3:31:55 PM
    Author     : Vamshidhar
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>

    <head>
        <title>hi</title>
         <script type="text/javascript" src="jquery.jstree.js"></script>
        <script type="text/javascript" src="jquery.js"></script>

    </head>
    <body>

 <div id="demo1" class="demo"></div>

<script type="text/javascript">
$(function () {
 $("#demo1").jstree({
  "xml_data" : {
   "data" : "" +
"<root>" +
 "<item id='node_1'>" +
  "<content><name>Root node 1</name></content>" +
 "</item>" +
 "<item>" +
  "<content><name>Root node 2</name></content>" +
 "</item>" +
 "<item parent_id='node_1'>" +
  "<content><name>Child node</name></content>" +
 "</item>" +
"</root>"
  },
  "plugins" : [ "themes", "xml_data" ]
 });
});
</script>

    </body>
</html>

谁能帮我找出问题所在?

提前致谢

4

1 回答 1

2

尝试更改加载 js 文件的顺序,这对我有用。

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.jstree.js"></script>

希望这有帮助,快乐

于 2010-11-04T16:23:22.780 回答