嗨,我们可以将一个 JS 文件从一个文件调用到另一个文件...表示多个 JS 文件。我在 JS 中有一个这样的面板,如果我调用另一个 JS 文件,它应该读取这个 PANEL 控制值。
user1194374
问问题
1649 次
1 回答
0
您可以将一个 js 文件内容用于另一个 js 文件。像这样使用 //file1.js
var tabs = Ext.createWidget('tabpanel', {
cls: "auto-width-tab-strip",
activeTab: 0,
plain: true,
autoHeight: true,
defaults: {
autoHeight: true,
style: 'min-height:620px; padding:10px;'
},
items: [{
title: 'tab1',
loader: {
url: 'tab1.jsp',
scripts: true,
loadMask: true
}
}]
});
function myFirstFun(){
something
......
......
}
//End of file1.js
您可以重用上面的代码有些地方像这样 //file2.js
var panel = Ext.create('Ext.panel.Panel', {
title: 'Forum Search',
height: 300,
width: 600,
renderTo: 'search-panel',
id: 'search-results',
layout: 'fit',
items: tabs
});
Ext.get('someid').on('click', function(){
myFirstFun();
});
//End of file2.js
像这样你可以在file2.js中调用file1.js函数,但是你已经在你的html页面中包含了这两个js文件。
我想这可能会对你有所帮助。
于 2012-02-22T13:11:40.543 回答