easyUi学习之tabs的学习

本文介绍如何使用EasyUI实现选项卡组件的动态加载功能。具体包括:1. 导入所需的CSS和JS文件;2. 页面布局设置,包含一个按钮和三个初始选项卡;3. 通过按钮触发事件,向选项卡中添加新内容,内容通过URL从另一个页面获取。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

easyui的选项卡使用:
1.导入需要的css和js
 <head>
<link rel="stylesheet" type="text/css" href="css/default/easyui.css">
<link rel="stylesheet" type="text/css" href="js/jquery/jquery-easyui-1.2.1/themes/icon.css">
<script type="text/javascript" src="js/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery-easyui-1.2.1/jquery.easyui.min.js"></script>

</head>

2.页面是有一个button按钮和三个选项卡,点击按钮然后添加一个选项卡,这个选项卡的内容是从另一个页面通过url获取到的,代码如下:
<body>
<button id='addTabs' onclick='addTestTab1();'>add</button>
<div id='tt1' class="easyui-tabs" style="height: 250px;width: 500px">
<div title='tab1' style="padding: 20px;display: none" >
tab1
</div>
<div title='tab2' style="overflow: auto;display: none;padding: 20px" closable='true'>
tab2
</div>
<div title='tab3' icon="icon-reload" closable='true' style="padding: 20px;display: none">
tab3
</div>
</div>
</body>


button按钮时间代码如下:
 <script type="text/javascript">
function addTestTab(){
$("#tt").tabs('add',{
title:'保存',
content:'测试内容',
closable:true,
icon:'icon-save',
href:'http://localhost:8082/TestEasyUi/tab1.jsp'
});
}
</script>
</script>


ta1.jsp的代码和上面的代码一样,可以直接coppy过去

我用的是eclispe创建的web项目,所以启动服务器,输入路径,结果如下:

[img]http://dl2.iteye.com/upload/attachment/0103/5688/b9104f63-f8eb-3dbb-b0cb-60fc15fe8abc.jpg[/img]

[img]http://dl2.iteye.com/upload/attachment/0103/5690/07d0f5e2-eca4-3679-afb5-03c0e21d8f1d.jpg[/img]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值