/*--------------------------------------------------|
| dTree 2.05 | www.destroydrop.com/javascript/tree/ |
|---------------------------------------------------|
| Copyright (c) 2002-2003 Geir Landr? |
| |
| This script can be used freely as long as all |
| copyright messages are intact. |
| |
| Updated: 17.04.2003 |
|--------------------------------------------------*/
// ��
//
/*
�ڵ�������
@param actionUrl ����Url ����
@param actionIcon ����ͼ�� ����
@param actionTitle ������ʾ
@param actionTarget ����target
@return
*/
function NodeAction(actionUrl,actionIcon,actionTitle,actionTarget){
this.actionUrl=actionUrl;
this.actionIcon=actionIcon;
this.actionTarget=actionTarget;
this.actionTitle=actionTitle;
};
// Node object
function Node(id, pid, name, url, title, target, icon, iconOpen, open) {
this.id = id;
this.pid = pid;
this.name = name;
this.url = url;
this.title = title;
this.target = target;
this.icon = icon;
this.iconOpen = iconOpen;
this._io = open || false;
this._is = false;
this._ls = false;
this._hc = false;
this._ai = 0;
this._p;
};
/*
nodeActionList �ǽڵ�������NodeAction object�����б�
���磺
nodeActionList=new List();
List������ java-like.util.js���
*/
function Node(id, pid, name, url, title, target, icon, iconOpen, open,nodeActionList) {
this.id = id;
this.pid = pid;
this.name = name;
this.url = url;
this.title = title;
this.target = target;
this.icon = icon;
this.iconOpen = iconOpen;
this._io = open || false;
this._is = false;
this._ls = false;
this._hc = false;
this._ai = 0;
this.nodeActionList=nodeActionList;
this._p;
};
// Tree object
function dTree(objName) {
this.config = {
//ͼƬ·��
imageDir :null,
target : null,
folderLinks : true,
useSelection : true,
useCookies : true,
useLines : true,
useIcons : true,
useStatusText : false,
closeSameLevel : false,
inOrder : false,
check:true, //默认没有 checkbox
mycheckboxName: "mycheckbox" //checkbox的name属性 用作form表单提交
}
this.icon = {
root :(this.config.imageDir!=null)?this.config.imageDir="/"+base.gif: 'js/dtree2/img/base.gif',
folder : 'js/dtree3/img/folder.gif',
folderOpen : 'js/dtree3/img/folderopen.gif',
node : 'js/dtree3/img/page.gif',
empty : 'js/dtree3/img/empty.gif',
line : 'js/dtree3/img/line.gif',
join : 'js/dtree3/img/join.gif',
joinBottom : 'js/dtree3/img/joinbottom.gif',
plus : 'js/dtree3/img/plus.gif',
plusBottom : 'js/dtree3/img/plusbottom.gif',
minus : 'js/dtree3/img/minus.gif',
minusBottom : 'js/dtree3/img/minusbottom.gif',
nlPlus : 'js/dtree3/img/nolines_plus.gif',
nlMinus : 'js/dtree3/img/nolines_minus.gif',
iconUnCheckAll : 'js/dtree3/img/iconUnCheckAll.gif',
iconCheckAll :'js/dtree3/img/iconCheckAll.gif',
iconCheckGray : 'js/dtree3/img/iconCheckGray.gif'
};
this.obj = objName;
this.aNodes = [];
this.aIndent = [];
this.root = new Node(-1);
this.selectedNode = null;
this.selectedFound = false;
this.completed = false;
};
// Tree object
dTree.prototype.reSetImagePath=function(){
this.icon = {
root :(this.config.imageDir!=null)?this.config.imageDir+'/base.gif': 'img/base.gif',
folder : (this.config.imageDir!=null)?this.config.imageDir+'/folder.gif':'img/folder.gif',
folderOpen : (this.config.imageDir!=null)?this.config.imageDir+'/folderopen.gif':'img/folderopen.gif',
node : (this.config.imageDir!=null)?this.config.imageDir+'/page.gif':'img/page.gif',
empty : (this.config.imageDir!=null)?this.config.imageDir+'/empty.gif':'img/empty.gif',
line : (this.config.imageDir!=null)?this.config.imageDir+'/line.gif':'img/line.gif',
join : (this.config.imageDir!=null)?this.config.imageDir+'/join.gif':'img/join.gif',
joinBottom : (this.config.imageDir!=null)?this.config.imageDir+'/joinbottom.gif':'img/joinbottom.gif',
plus : (this.config.imageDir!=null)?this.config.imageDir+'/plus.gif':'img/plus.gif',
plusBottom : (this.config.imageDir!=null)?this.config.imageDir+'/plusbottom.gif':'img/plusbottom.gif',
minus : (this.config.imageDir!=null)?this.config.imageDir+'/minus.gif':'img/minus.gif',
minusBottom : (this.config.imageDir!=null)?this.config.imageDir+'/minusbottom.gif':'img/minusbottom.gif',
nlPlus : (this.config.imageDir!=null)?this.config.imageDir+'/nolines_plus.gif':'img/nolines_plus.gif',
nlMinus : (this.config.imageDir!=null)?this.config.imageDir+'/nolines_minus.gif':'img/nolines_minus.gif',
//checkbox 图片
iconUnCheckAll : (this.config.imageDir!=null)?this.config.imageDir+'/iconUnCheckAll.gif':'img/iconUnCheckAll.gif',
iconCheckAll : (this.config.imageDir!=null)?this.config.imageDir+'/iconCheckAll.gif':'img/iconCheckAll.gif',
iconCheckGray : (this.config.imageDir!=null)?this.config.imageDir+'/iconCheckGray.gif':'img/iconCheckGray.gif'
};
}
// Adds a new node to the node array
dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) {
this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open);
};
// Adds a new node to the node array
dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open,actionUrl,actionIcon) {
this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open,actionUrl,actionIcon);
};
// Open/close all nodes
dTree.prototype.openAll = function() {
this.oAll(true);
};
dTree.prototype.closeAll = function() {
this.oAll(false);
};
// Outputs the tree to the page
dTree.prototype.toString = function() {
var str = '<div class="dtree">\n';
if (document.getElementById) {
if (this.config.useCookies) this.selectedNode = this.getSelected();
str += this.addNode(this.root);
} else str += 'Browser not supported.';
str += '</div>';
if (!this.selectedFound) this.selectedNode = null;
this.completed = true;
return str;
};
// Creates the tree structure
dTree.prototype.addNode = function(pNode) {
var str = '';
var n=0;
if (this.config.inOrder) n = pNode._ai;
for (n; n<this.aNodes.length; n++) {
if (this.aNodes[n].pid == pNode.id) {
var cn = this.aNodes[n];
cn._p = pNode;
cn._ai = n;
this.setCS(cn);
if (!cn.target && this.config.target) cn.target = this.config.target;
if (cn._hc && !cn._io && this.config.useCookies) cn._io = this.isOpen(cn.id);
if (!this.config.folderLinks && cn._hc) cn.url = null;
if (this.config.useSelection && cn.id == this.selectedNode && !this.selectedFound) {
cn._is = true;
this.selectedNode = n;
this.selectedFound = true;
}
str += this.node(cn, n);
if (cn._ls) break;
}
}
return str;
};
// Creates the node icon, url and text
dTree.prototype.node = function(node, nodeId) {
var str = '<div class="dTreeNode">' + this.indent(node, nodeId);
if (this.config.useIcons) {
if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node);
if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node;
//新加的 checkbox
if(this.config.check==true){
str+= '<img check
没有合适的资源?快使用搜索试试~ 我知道了~
多项选择的树Dtree
共68个文件
gif:57个
repository:3个
entries:3个
需积分: 3 31 下载量 103 浏览量
2008-12-21
13:46:43
上传
评论
收藏 33KB RAR 举报
温馨提示
能够通过点击checkbox,实现多项选择的树Dtree
资源推荐
资源详情
资源评论
收起资源包目录
.rar (68个子文件)
多项选择的树
CVS
Entries 241B
Repository 23B
Root 39B
dtree.css 1KB
img
nolines_plus.gif 870B
table.gif 387B
folderopen1.gif 570B
plusbottom.gif 88B
user_add.gif 606B
plus.gif 89B
empty.gif 62B
folder2.gif 328B
CVS
Entries 2KB
Repository 27B
Root 39B
folder3.gif 990B
page233.gif 155B
line.gif 66B
imgfolder.gif 622B
joinbottom.gif 66B
folder1.gif 570B
trash.gif 1KB
iconCheckAll.gif 123B
folderopen2.gif 328B
folderopen.gif 187B
globe.gif 1KB
minus.gif 86B
minusbottom.gif 85B
base.gif 630B
f.gif 380B
musicfolder.gif 633B
iconCheckGray.gif 126B
iconUnCheckAll.gif 111B
join.gif 69B
folderopen4.gif 990B
question.gif 1KB
base3.gif 576B
nolines_minus.gif 861B
page1.gif 567B
page.gif 184B
cd.gif 239B
page3.gif 1KB
page2.gif 323B
folder.gif 189B
dtree.js 22KB
img1
nolines_plus.gif 870B
plusbottom.gif 88B
plus.gif 89B
empty.gif 62B
CVS
Entries 1008B
Repository 28B
Root 39B
line.gif 66B
imgfolder.gif 622B
joinbottom.gif 66B
trash.gif 1KB
folderopen.gif 376B
globe.gif 1KB
minus.gif 86B
minusbottom.gif 85B
base.gif 1KB
musicfolder.gif 633B
join.gif 69B
question.gif 1KB
nolines_minus.gif 861B
page.gif 582B
cd.gif 239B
folder.gif 372B
共 68 条
- 1
资源评论
zengjinhong
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功