81,090
社区成员
发帖
与我相关
我的任务
分享
<script type="text/javascript">
$(function(){
$('#tt').tabs({
onSelect:function(title,index){
alert("出来啦!");
},
tools:[{
iconCls:'icon-add',
handler: function(){
alert('add');
}
},{
iconCls:'icon-save',
handler: function(){
alert('save');
}
}]
});
});
var index = 0;
function addTab(){
index++;
$('#tt').tabs('add',{
title:'New Tab ' + index,
content:'Tab Body ' + index,
iconCls:'icon-save',
closable:true
});
}
</script>
你最好在网上找个API下下来,然后对照着使用
<body>
<h2>Tabs</h2>
<div class="demo-info">
<div class="demo-tip icon-tip"></div>
<div>Tabs are automatically made scrollable when the sum of their width exceeds their container width size.</div>
</div>
<div style="margin:10px 0">
<a class="easyui-linkbutton" icon="icon-add" href="javascript:void(0)" onclick="addTab()">add tab</a>
</div>
<div id="tt" style="width:700px;height:250px;">
<div title="Tab1" style="padding:20px;">
tab1
</div>
<div title="Tab2" closable="true" style="padding:20px;" cache="false">
Tab2
</div>
<div title="Tab3" iconCls="icon-reload" closable="true" style="padding:20px;">
tab3
</div>
</div>
</body>
javascript代码:
<script type="text/javascript">
$(function(){
$('#tt').tabs({
tools:[{
iconCls:'icon-add',
handler: function(){
alert('add');
}
},{
iconCls:'icon-save',
handler: function(){
alert('save');
}
}]
});
});
var index = 0;
function addTab(){
index++;
$('#tt').tabs('add',{
title:'New Tab ' + index,
content:'Tab Body ' + index,
iconCls:'icon-save',
closable:true
});
}
$("#tt").tabs({
onSelect:function(title,index){
alert("出来啦!");
}
});
</script>
$("#tt").tabs({
onSelect:function(title,index){
}
});
事件名:onSelect 参数 :title,index 功能:用户选择一个选项卡面板的时候触发。