1.上面的2个Freeform例子, 分别是根据XML描述文件1、XML描述文件2创建的;
2.源码分析:
//都使用了扩展用法
var countForFirefox=0;
function OnReady(id)
{
if($B.type == "firefox") {
countForFirefox++;
if(countForFirefox != 2) return;
id='';
}
if(id == 'AF' || id=='') {
AF.func("Build", "treelist/tab.xml");
//树列表: 立即加载数据
AF.func("tab1.T.Load", "treelistdata/data60.tsv-ex.txt");
}
if(id == 'AF2' || id=='') {
AF2.func("Build", "treelist/tab2.xml");
}
}
function OnEvent(id, Event, p1, p2, p3, p4)
{
if(id=='AF' && Event == "SelChanged" && p3=="cht" && p4=="0") {
//统计图: 首次显示
AF.func("Tab1.cht.Load", "treelistdata/chartdata.xml \r\n mode=asynch");
}
}
//按钮执行的js:
function insert()
{
//插入新选项卡
AF.func("InsertTab", "Tab1 \r\n 0 \r\n type=treelist; id=abc; text=ababs; url=treelist/t1.xml");
//将当前页切换到新的位置
AF.func("SetCurSel", "Tab1 \r\n 0");
}
|