如何访问TabPanel链接的页面中任意element的value?
比如创建tab的页面(比如叫做index.jsp)是如下所示的
Ext.onReady(function(){ // basic tabs 1, built from existing content var tabs = new Ext.TabPanel({ renderTo: 'tabs1', width:450, activeTab: 0, frame:true, defaults:{autoHeight: true}, items:[ {contentEl:'script', title: 'Short Text'}, {contentEl:'markup', title: 'Long Text'} ] }); var tabs2 = new Ext.TabPanel({ renderTo: document.body, activeTab: 0, width:600, height:250, plain:true, defaults:{autoScroll: true}, items:[{ id: 'tab1', title: 'Normal Tab', html: "test.jsp" } ] });
在test.jsp页面中比如有下面一行html代码
<input value="testInput" id="testInput">
那么我怎么在index.jsp中得到testInput的value → "testInput"
有这个想法是因为比如某页面包含了3个tab,并且3个页面都需要获得一些信息或者进行某些处理得到一些信息,这样我在index.jsp提交时需要获取3个tab中的这些信息并通过表单提交。
渲染后其实就是在该页面了.
html:'test.jsp'其实就是ajax去请求页面,然后得到的html片段写入到指定的地方.
用Ext.get('testInput')就可以得到这个Element对象了.
ps:几个tab里面的jsp里面的控件,id注意不要重复.
ps2:不建议用contentEl+html这种方式
[code="js"]
var tabs,tabs2;
Ext.onReady(function(){
// basic tabs 1, built from existing content
tabs = new Ext.TabPanel({
renderTo: 'tabs1',
width:450,
activeTab: 0,
frame:true,
defaults:{autoHeight: true},
items:[
{contentEl:'script', title: 'Short Text'},
{contentEl:'markup', title: 'Long Text'}
]
});
tabs2 = new Ext.TabPanel({
renderTo: document.body,
activeTab: 0,
width:600,
height:250,
plain:true,
defaults:{autoScroll: true},
items:[{
id: 'tab1',
title: 'Normal Tab',
html: "test.jsp"
}
]
});
[/code]
下面的代码在那个页面里面呀?请描述清楚
[code="js"]
[/code]