浏览 233 次
|
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
|---|---|
| 作者 | 正文 |
|
时间:2008-04-13
比如说
<div id="ttabs" dojoType="TabContainer"
labelPosition="bottom" style="width: 400px; height: 400px;">
<span id="ttab1" dojoType="ContentPane" href="tab1.html" label="Tab 1"
closable="true"></span>
<span id="ttab2" dojoType="ContentPane" href="tab2.html"
refreshOnShow="true" label="Tab 2"></span>
<span dojoType="ContentPane" label="Tab 3" onClose="testClose" closable="true">
If you try to close me there should be a confirm dialog.
</span>
</div>
现在我已经有三个tab页,我想写一个函数 向ttabs里面添加多一个tab页 应该如何做呢? dojo版本为 0.4 struts2中自带的。 谢谢 声明:JavaEye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
| 返回顶楼 | |
|
时间:2008-04-13
在test例子中找到了解决方法
function setCssText(node, cssText){
// make opera sing
if(dojo.lang.isUndefined(node.style.cssText)){
node.setAttribute("style", cssText);
}else{
node.style.cssText= cssText;
}
}
function addATab(father,id,name){
widget = dojo.widget.byId(father);
// setup input node
var node = document.createElement("div");
setCssText(node, "padding:8px; overflow: auto;width:100%;height:100%"); // necessary if parent is LayoutContainer
var child = dojo.widget.createWidget(
"ContentPane",
{
widgetId: id,
label: name, // necessary if parent is tab
layoutAlign: "bottom", // necessary if parent is LayoutContainer
executeScripts: true,
closable:true
},
node
);
widget.addChild(child);
}
addATab('ttabs','id','name');
即可
|
|
| 返回顶楼 | |


