未捕获的TypeError:Object#<object>没有方法'tree'</object>

时间:2012-11-22 07:37:42

标签: javascript jquery jquery-ui jquery-plugins coffeescript

* *收到此错误“未捕获TypeError:对象#没有方法'树'” 在这个“$('#tree1')。tree”代码行 请参考此http://mbraak.github.com/jqTree/ 相同的代码在其他页面上工作,但它只包含 1.jqtree.css 2.div id = tree1 div 3.和三个jquery文件jquery-1.8.0.js,tree.jquery.js和prism.js 4.包含在下面的脚本标记中编写的fumction代码


<head>
    <title>Ksa Maps</title>
    <link href="../Css/Site.css" rel="stylesheet" type="text/css" />   
    <link href="../Css/advancedtable.css" rel="stylesheet" type="text/css" />
    <link href="../Css/AdvTblStyle.css" rel="stylesheet" type="text/css" />
    <link href="../Css/jquery-ui-1.8.21.custom.css" rel="stylesheet" type="text/css" /> 
    <link href="../Css/CityFilter.css" rel="stylesheet" type="text/css" />
    <link href="../Css/ddsmoothmenu.css" rel="stylesheet" type="text/css" />
    <link href="../Css/dcmegamenu.css" rel="stylesheet" type="text/css" />
    <link href="../Js/autoCombo/tryy.css" rel="stylesheet" type="text/css" />
    <link href="../Js/autoCombo/demos.css" rel="stylesheet" type="text/css" />
    <link href="menu.css" rel="stylesheet" type="text/css" />
    <link href="../jquery.confirm/jquery.confirm.css" rel="stylesheet" type="text/css" />
       <!--  Tree-->
      <link href="../Css/jqtree.css" rel="stylesheet" type="text/css" />   
     <!--<link href='http://fonts.googleapis.com/css?family=Corben:bold&amp;v1' rel='stylesheet' type='text/css'>-->
     <!--  Tree-->

</head>
<body>
 <div id="tree1"></div>  
    <script src="../Js/autoCombo/jquery-1.8.0.js" type="text/javascript"></script>
    <!-- tree  --> 
    <script src="../Js/prism.js" type="text/javascript"></script>
    <script src="../Js/tree.jquery.js" type="text/javascript"></script>
   <!-- tree  --> 
    <script src="../Js/autoCombo/jquery.ui.core.js" type="text/javascript"></script>
    <script src="../Js/autoCombo/jquery.ui.autocomplete.js" type="text/javascript"></script>
    <script src="../Js/autoCombo/jquery.ui.button.js" type="text/javascript"></script>
    <script src="../Js/autoCombo/jquery.ui.position.js" type="text/javascript"></script>
    <script src="../Js/autoCombo/jquery.ui.widget.js" type="text/javascript"></script>  
    <script src="../Js/JQuery.js" type="text/javascript"></script>
    <script src="../Js/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="../Js/picnet.table.filter.min.js" type="text/javascript"></script>     
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?v=3.9&sensor=true"></script>
    <script src="../Js/jquery-ui-1.8.22.custom.min.js" type="text/javascript"></script>
    <script src="../Js/advancedtable.js" type="text/javascript"></script>  
    <script src="../Js/ddsmoothmenu.js" type="text/javascript"></script>
    <script src="../Js/poiScript.js" type="text/javascript"></script>
    <script src="../Js/jquery-ui-1.8.21.custom.min.js" type="text/javascript"></script>
    <script src="../Js/jquery.dcmegamenu.1.3.3.min.js" type="text/javascript"></script>
    <script src="../Js/jquery.hoverIntent.minified.js" type="text/javascript"></script>
    <script src="../Js/jquery.dcmegamenu.1.3.3.js" type="text/javascript"></script>
    <script src="../Js/menu.js" type="text/javascript"></script>
    <script src="../Js/autoCombo/TRYY.js" type="text/javascript"></script>
    <script src="../jquery.confirm/jquery.confirm.js" type="text/javascript"></script> 
    <script>
       $(function() {
           var data = [
            {
                label: 'node1',
                children: [
                    { label: 'child1' },
                    { label: 'child2' }
                ]
            },
            {
                label: 'node2',
                children: [
                    { label: 'child3' }
                ]
            }
        ];
           $('#tree1').tree({
               data: data,
               autoOpen: true,
               dragAndDrop: true
           });
       });
</script>
</body>
</html>

1 个答案:

答案 0 :(得分:2)

移动tree.jquery.js <script> 实际的jquery.js <script>后:

 <div id="tree1"></div>  
    <script src="../Js/autoCombo/jquery-1.8.0.js" type="text/javascript"></script>
    <script src="../Js/autoCombo/jquery.ui.core.js" type="text/javascript"></script>
    <script src="../Js/autoCombo/jquery.ui.autocomplete.js" type="text/javascript"></script>
    <script src="../Js/autoCombo/jquery.ui.button.js" type="text/javascript"></script>
    <script src="../Js/autoCombo/jquery.ui.position.js" type="text/javascript"></script>
    <script src="../Js/autoCombo/jquery.ui.widget.js" type="text/javascript"></script>  
    <script src="../Js/JQuery.js" type="text/javascript"></script>
    <script src="../Js/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="../Js/picnet.table.filter.min.js" type="text/javascript"></script>     
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?v=3.9&sensor=true"></script>
    <script src="../Js/jquery-ui-1.8.22.custom.min.js" type="text/javascript"></script>
    <script src="../Js/advancedtable.js" type="text/javascript"></script>  
    <script src="../Js/ddsmoothmenu.js" type="text/javascript"></script>
    <script src="../Js/poiScript.js" type="text/javascript"></script>
    <script src="../Js/jquery-ui-1.8.21.custom.min.js" type="text/javascript"></script>
    <script src="../Js/jquery.dcmegamenu.1.3.3.min.js" type="text/javascript"></script>
    <script src="../Js/jquery.hoverIntent.minified.js" type="text/javascript"></script>
    <script src="../Js/jquery.dcmegamenu.1.3.3.js" type="text/javascript"></script>
    <script src="../Js/menu.js" type="text/javascript"></script>
    <script src="../Js/autoCombo/TRYY.js" type="text/javascript"></script>
    <script src="../jquery.confirm/jquery.confirm.js" type="text/javascript"></script>
    <!-- tree  --> 
    <script src="../Js/prism.js" type="text/javascript"></script>
    <script src="../Js/tree.jquery.js" type="text/javascript"></script>
   <!-- tree  --> 

实际上,您似乎已经包含了很多的jQuerys。你需要删除很多这些。