日期:2014-05-16 浏览次数:20368 次
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>无标题页</title> <link type="text/css" href="/ext/resources/css/ext-all.css" rel="Stylesheet" /> <script type="text/javascript" src="/ext/ext-base.js"></script> <script type="text/javascript" src="/ext/ext-all.js"></script> </head> <script type="text/javascript"> var treeWnd; Ext.onReady(function(){ var json=[{text:'选项1',children:[{text:'选项11',leaf:true}]},{text:'选项2',leaf:true}];//你可以用自己的json var treePan=new Ext.tree.TreePanel({ root:{text:'请选择',children:json} }); treeWnd=new Ext.Window({items:[treePan],width:120,height:180,closeAction:'hide'}); treePan.on('click',function(node){ var obj=document.getElementById('tree'); obj.value=node.text; treeWnd.hide(); }); }) function showTree() { treeWnd.show(); var obj=document.getElementById('tree'); treeWnd.setPosition(obj.offsetLeft,obj.offsetTop+28); } </script> <body> <form id="form1" runat="server"> <div> <input id='tree' type="text" onclick="showTree();" style="margin-left:90px;margin-top:30px;" /> </div> </form> </body> </html>