easyui静态tree点击打开右侧tab实现

jsp

div中
左侧

<script type="text/javascript" src="js/home.js"></script>
    <div data-options="region:'west',title:'导航',split:true,collapsible:false,iconCls:'icon-system'" 
    	style="width:200px;padding:10px">
    		<ul id="nav"></ul>
       </div>
中心

 <div data-options="region:'center'" style="overflow:hidden;">
    	<div id="tabs">
    		<div title="起始页" style="padding:0,10px;display:block;">欢迎进入系统</div>
    	</div>
    </div>   
同时自定义左侧小图标,添加16*16图片到icon文件夹下,在icon.css中添加相应条目

js中

$(function(){
	$('#tabs').tabs({
		fit:true,
		border:false,
	});
 
    //在右边center区域打开菜单,新增tab  
    function Open(text, url,icon) {  
        if ($("#tabs").tabs('exists', text)) {  
            $('#tabs').tabs('select', text);  
        } else {  
            $('#tabs').tabs('add', {  
                title : text,  
                closable : true,  
                content : url,
                iconCls : icon
            });  
        }  
    }  
    $('#nav').tree({
    	data: [{
    		text:"系统模块",
    		"iconCls":"icon-system",    
    	    "children":[{    
    	        "text":"审核模块", 
    	        "iconCls":"icon-check",
    	        "children":[{
    	        	"text":"身份审核", 
    		        "iconCls":"icon-admin",
    	        	attributes : {  
    	                url : '<iframe width="100%" height="100%" frameborder="0"  src="tab1.jsp" style="width:100%;height:100%;margin:0px 0px;"></iframe>'  
    	            }    
    	        },{
    	        	"text":"请假审核", 
    		        "iconCls":"icon-holiday",
    	        	attributes : {  
    	                url : '<iframe width="100%" height="100%" frameborder="0"  src="tab2.jsp" style="width:100%;height:100%;margin:0px 0px;"></iframe>'  
    	            }
    	        }]
    	    },{
    	    	"text":"成绩模块", 
    	        "iconCls":"icon-record",
    	        "children":[{
    	        	"text":"上传成绩",   		     
    		        "iconCls":"icon-grade",
    	        	attributes : {  
    	                url : '<iframe width="100%" height="100%" frameborder="0"  src="tab3.jsp" style="width:100%;height:100%;margin:0px 0px;"></iframe>'  
    	            }    
    	        }]
    	    },{
    	    	"text":"课表模块", 
    	       
    	        "iconCls":"icon-course",
    	        "children":[{
    	        	"text":"上传成绩", 	      
    		        "iconCls":"icon-up",
    	        	attributes : {  
    	                url : '<iframe width="100%" height="100%" frameborder="0"  src="tab4.jsp" style="width:100%;height:100%;margin:0px 0px;"></iframe>'  
    	            }    
    	        }]
    	    },{
    	    	"text":"聊天功能", 
    	        "iconCls":"icon-chat",
    	        attributes : {  
                    url : '<iframe width="100%" height="100%" frameborder="0"  src="tab5.jsp" style="width:100%;height:100%;margin:0px 0px;"></iframe>'  
                }
    	    }]
    	}],
    	lines : true,  
      onClick : function (node) {  
          if (node.attributes) {  
              Open(node.text, node.attributes.url,node.iconCls);  
          }  
      }  
    
    });



});

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值