Code
/// <reference path="extjs/vswd-ext_2.2.js"/>
Ext.onReady(load);
var tp; //tabPanel
var tab_index = 1000;
function load()
{
tp = new Ext.TabPanel//实例化ext的panel空间
({
activeTab:0,autoWidth:true,border:false,frame:false,id:"tp",enableTabScroll:true,
items:
[
{
xtype:"panel",layout:'fit',title:"首 页",border:false,frame:false,
html:"<iframe scrolling='auto' width='100%' height='100%' frameborder='0' src='home.aspx'></iframe>"//嵌入iframe
}
]
});
var panel_center = new Ext.Panel
({
id:'panleCenter',frame:false,border:false,
region:'center',
split:true,
items:[tp],
layout:'fit'
});
var viewport = new Ext.Viewport
({
id:'vpMain',
layout:'border',
items:
[
panel_center
]
});
otherTab();
}
function newTab(_title,url)//定义方法,添加进当前的tabpanel一个panel
{
tp.add({
xtype:"panel",layout:'fit',title:_title,border:false,frame:false,
id: 'newtab' + tab_index,
closable:true,
html:"<iframe scrolling='auto' width='100%' height='100%' frameborder='0' src='" + url + "'></iframe>"
});
tp.setActiveTab('newtab' + tab_index);
tab_index ++;
}
function newTabClose()//关闭上一个tab
{
我想在这里关闭一个id为 tab_index-1 的tab 该怎么办啊?
// alert('newtab');
//tp.remove(tp.findById('newtab' + (tab_index - 1)), true);
//tp.findById('newtab' + (tab_index - 1)).remove();
}
请问 上面 newTabClose()方法 里面要怎么实现啊?
谢谢各位、