BeQ通用树形控件Ver1.0Beta

/*
*☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
*★                                 ★
*☆          BeQ 通用树形控件 Ver 1.0 Beta          ☆
*★                                 ★
*☆ 版权所有: BeQ (BQ)                        ☆
*★                                 ★
*☆ 程序制作: BeQ (BQ)                        ☆
*★   MSN:  bq_x@msn.com                     ★
*☆   email:bq@bqprog.com                      ☆
*★                                 ★
*☆   QQ: 16486280                        ☆
*★                                 ★
*☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
*/

function addTreeNode(index , nodeText , nodeIcon , selIcon , nodeData , nodeAction)
{
 var st_pNode = this.tree;
 index = parseInt(index);

 if(index>this.nodes.length)index = this.nodes.length;
 
 var cindex = 0;
 for(i=0;(i<this.nodes.length)&&(i<index);i++)
 {
  if(this.nodes[i]=="[tree node]")
  {
   cindex++;
  }
  else if(this.nodes[i]=="[tree branch]")
  {
   cindex+=2;
  }
 }

 var tr = st_pNode.insertRow(cindex);
 var td;
 td = tr.insertCell(0);
 td.innerHTML="<img src=/""+nodeIcon+"/" border=0>";
 td.vAlign="middle";
 td.noWrap = true;
 td.height=22;
 td.width=22;
 td = tr.insertCell(1);
 td.height=22;
 td.vAlign="middle";
 td.noWrap = true;
 td.innerHTML = "<table border=0 cellpadding=0 cellspacing=0><tr><td><img src=/"" + nodeIcon + "/" border=0></td><td nowrap>&nbsp;<label alt='' title='' hidefocus='true' treeType='node' style='cursor:default;'>"+nodeText+"</label></td></tr></table>";
 var iconImg = td.firstChild.rows[0].cells[0].firstChild;
 var textSP = td.firstChild.rows[0].cells[1].firstChild.nextSibling;

 textSP.ondragstart = new Function("this.node.ondargstart();");
 textSP.onmousemove = new Function("window.status='';");

 td.firstChild.rows[0].cells[1].onmouseover = new Function("this.className='"+this.tdMouseOver+"';");
 td.firstChild.rows[0].cells[1].onmouseout = new Function("this.className='"+this.tdMouseOut+"';");
 td.firstChild.rows[0].cells[1].className = this.tdMouseOut;

 textSP.onmouseover = new Function("this.className='"+this.spanMouseOver+"';");
 textSP.onmouseout = new Function("this.className='"+this.spanMouseOut+"';");
 textSP.className = this.spanMouseOut;
 var tn = new treeNode(tr);
 tn.icon = nodeIcon;
 tn.selIcon = selIcon;
 tn.data = nodeData;
 tn.nodeAction = nodeAction;
 tn.parent = this;
 td.firstChild.rows[0].cells[1].node = tn;
 textSP.node = tn;
 tn.text = nodeText;
 tn.textSP = textSP;
 tn.iconImg = iconImg;
 td.firstChild.rows[0].cells[1].onclick = new Function("this.node.onSelected();");
// this.nodes.splice(index , 0 , tn );
 var tmpNodes = new Array;
 for(i=0;i<index;i++)
 {
  tmpNodes[i]=this.nodes[i];
 }
 tmpNodes[tmpNodes.length]=tn;
 for(i=index;i<this.nodes.length;i++)
 {
  tmpNodes[i+1]=this.nodes[i];
 }
 this.nodes=tmpNodes;

 if(this.opened)
 {
  this.TreeRow.style.display="";
 }


 if(index!=0)
 {
  var preSibling = this.nodes[index-1];
  if(preSibling.toString()=="[tree branch]")
  {
   if(preSibling.opened)
   {
    preSibling.img.src="../images/minus.gif"
   }
   else
   {
    preSibling.img.src="../images/plus.gif"
   }
   preSibling.TreeRow.cells[0].style.backgroundImage="url(../images/barI.gif)";
  }
  else
  {
   preSibling.img.src="../images/barH.gif";
  }
 }

 if(index==this.nodes.length-1)
 {
  tn.img.src="../images/barL.gif";
 }
 else
 {
  tn.img.src="../images/barH.gif";
 }

 return tn;
}

function delTreeNode(index)
{
 var tr,tr2;
 index = parseInt(index);
 tr2 = null;
 if ( this.nodes[index].toString() != "[tree node]" )
 {
  tr = this.nodes[index].subTree;
  tr2 = tr.nextSibling;
  this.tree.deleteRow(tr2.rowIndex);
 }
 else
 {
  tr = this.nodes[index].tree;
 }
 this.tree.deleteRow(tr.rowIndex);

 var tmpNodes = new Array;
 for(i=0;i<parseInt(index);i++)
 {
 tmpNodes[i] = this.nodes[i];
 }
 for(i=parseInt(index)+1;i<this.nodes.length;i++)
 {
  tmpNodes[i-1] = this.nodes[i];
 }
 this.nodes=tmpNodes;
 
 if(this.length()==0)
 {
  this.TreeRow.style.display="none";
 }

 if((index==this.nodes.length)&&(index!=0))
 {
  var pre = this.nodes[index-1];
  if(pre.toString()=="[tree branch]")
  {
   if(pre.opened)
   {
    pre.img.src="../images/minusL.gif";
   }
   else
   {
    pre.img.src="../images/plusL.gif";
   }
   pre.TreeRow.cells[0].style.backgroundImage="";
  }
  else
  {
   pre.img.src="../images/barL.gif";
  }
 }
}

function treeGetLength()
{
 return this.nodes.length;
}

function treeToString()
{
 return "[tree]";
}

function treeAddBranch(index , branch)
{
 index = parseInt(index);

 if(index>this.nodes.length)index = this.nodes.length;
 var cindex = 0;
 for(i=0;(i<this.nodes.length)&&(i<index);i++)
 {
  if(this.nodes[i]=="[tree node]")
  {
   cindex++;
  }
  else if(this.nodes[i]=="[tree branch]")
  {
   cindex+=2;
  }
 }
 var tr = this.tree.insertRow(cindex);

 branch.parent = this;
 if ( typeof(branch.tdMouseOver) == "undefined")branch.tdMouseOver = this.tdMouseOver;
 if ( typeof(branch.tdMouseOut) == "undefined")branch.tdMouseOut = this.tdMouseOut;
 if ( typeof(branch.spanMouseOver) == "undefined")branch.spanMouseOver = this.spanMouseOver;
 if ( typeof(branch.spanMouseOut) == "undefined")branch.spanMouseOut = this.spanMouseOut;

 var td;
 td = tr.insertCell(0);
 td.height=22;
 td.width=22;
 if(index==this.length())
 {
 td.innerHTML="<img src=/"../images/plusL.gif/" border=0 οnclick=/"this.branch.ExpandOrClose();/">";
 }
 else
 {
 td.innerHTML="<img src=/"../images/plus.gif/" border=0>";
 }
 branch.img = td.firstChild;
 branch.img.branch = branch;
 td.vAlign="middle";
 td.noWrap = true;
 
 td = tr.insertCell(1);
 td.height=22;
 td.vAlign="middle";
 td.noWrap = true;
 td.innerHTML = "<table border=0 cellpadding=0 cellspacing=0><tr><td><img src=/"" + branch.openImg + "/" border=0 οnclick=/"this.branch.ExpandOrClose();/"></td><td nowrap>&nbsp;<label treeType='branch' style='cursor:default;'>"+branch.text+"</label>&nbsp;</td></tr></table>";
 branch.icon = td.firstChild.rows[0].cells[0].firstChild;
 branch.icon.branch = branch;
 branch.textSP = td.firstChild.rows[0].cells[1].firstChild.nextSibling;

 branch.subTree = tr;

 tr = this.tree.insertRow(cindex+1);
 tr.style.display="none";
 td = tr.insertCell(0);
 td.width=22;
 td.innerHTML="";
 if(index!=this.nodes.length)
 {
 td.style.backgroundImage="url(../images/barI.gif)";
 }
 td.noWrap = true;
 td = tr.insertCell(1);
 td.innerHTML="<table cellspacing=0 cellpadding=0 border='0'></table>";
 td.noWrap = true;

 branch.tree = td.firstChild;
 branch.TreeRow = tr;

 td.onmouseover = new Function("this.className='"+branch.tdMouseOver+"';");
 td.onmouseout = new Function("this.className='"+branch.tdMouseOut+"';");
 td.className = branch.tdMouseOut;
 
 branch.tree.branch = branch;
 branch.subTree.branch = branch;
 branch.textSP.branch = branch;
 branch.textSP.onclick = new Function("this.branch.TextSPClicked();");
 branch.textSP.ondblclick = new Function("this.branch.ExpandOrClose();this.branch.TextSPClicked();");
 branch.textSP.onmouseover = new Function("this.className='"+branch.spanMouseOver+"';");
 branch.textSP.onmouseout = new Function("this.className='"+branch.spanMouseOut+"';");
 branch.textSP.className = branch.spanMouseOut;

 var tmpNodes = new Array;
 for(i=0;i<index;i++)
 {
  tmpNodes[i]=this.nodes[i];
 }
 tmpNodes[tmpNodes.length]=branch;
 for(i=index;i<this.nodes.length;i++)
 {
  tmpNodes[i+1]=this.nodes[i];
 }
 this.nodes=tmpNodes;

 branch.close();

 if(index!=0)
 {
  var preSibling = this.nodes[index-1];
  if(preSibling.toString()=="[tree branch]")
  {
   if(preSibling.opened)
   {
    preSibling.img.src="../images/minus.gif"
   }
   else
   {
    preSibling.img.src="../images/plus.gif"
   }
   preSibling.TreeRow.cells[0].style.backgroundImage="url(../images/barI.gif)";
  }
  else
  {
   preSibling.img.src="../images/barH.gif";
  }
 }

 if(this.opened)
 {
  this.TreeRow.style.display="";
 }

 return branch;
}

function tree(parentNode)
{
 this.nodes = new Array();
 this.addNode = addTreeNode;
 this.addBranch = treeAddBranch;
 this.delNode = delTreeNode;
 this.length = treeGetLength;
 this.toString = treeToString;

 this.tdMouseOver = "treetdMouseOver";
 this.tdMouseOut = "treetdMouseOut";
 this.spanMouseOver = "treespanMouseOver";
 this.spanMouseOut = "treespanMouseOut";

 this.tree = "";
 if(MM_findObj(parentNode)!=null){
  this.tree = MM_findObj(parentNode);
 }
}

function treeNodeText(text)
{
 this.text = text;
 this.textSP.innerHTML = text;
 if(this.NodeClass)
 {
  this.setClass(this.NodeClass);
 }
}

function treeNodeAction(text)
{
 this.nodeAction = text;
}

function treeNodeToString()
{
return "[tree node]";
}

function treeNodeSelected()
{
 var p = null;
 p = this.parent;
 while((p.parent!=null)&&(typeof(p.parent)!="undefined"))
 {
  p = p.parent;
 }

 treeUnselect(p);

 this.textSP.parentNode.style.border="1px dotted #808080";

 this.selected = true;

 this.iconImg.src = this.selIcon;

 if(this.nodeAction!=null)
 {
  eval(this.nodeAction);
 }
}

function treeNodeSetClass(cnspan)
{
 this.tree.cells[1].onmouseover = null;//new Function("this.className='"+cnspan+"MouseOver';");
 this.tree.cells[1].onmouseout = null;//new Function("this.className='"+cnspan+"MouseOut';");
 this.tree.cells[1].className = '';//cnspan+"MouseOut";

 this.NodeClass = cnspan;

// this.tree.cells[1].firstChild.onmouseover = new Function("this.className='"+cnspan+"MouseOver';");
// this.tree.cells[1].firstChild.onmouseout = new Function("this.className='"+cnspan+"MouseOut';");
// this.tree.cells[1].firstChild.className = cnspan+"MouseOut";

 if(this.textSP)
 {
  this.textSP.onmouseover = new Function("this.className='"+cnspan+"MouseOver';");
  this.textSP.onmouseout = new Function("this.className='"+cnspan+"MouseOut';");
  this.textSP.className = cnspan+"MouseOut";
 }
}

function treeNodeSetIcon(icon , selIcon)
{
 this.icon = icon;
 this.selIcon = selIcon;
 if(this.selected == true)
 {
  this.icon.src = this.selIcon;
 }
 else
 {
  this.icon.src = this.icon;
 }
}

function onTreeNodeDragStart()
{
 eval(this.ondragstartAction);
}

function treeNodeOnUnselect()
{
 this.textSP.parentNode.style.border="";
 this.selected = false;
}

function treeNode(tr)
{
 this.tree = tr;
 this.img = tr.cells[0].firstChild;
 this.text = "";
 this.data = "";
 this.selIcon = "";
 this.icon = "";
 this.nodeAction = "";
 this.selected = false;
 this.setText = treeNodeText;
 this.setAction = treeNodeAction;
 this.setIcon = treeNodeSetIcon;
 this.onSelected = treeNodeSelected;
 this.toString = treeNodeToString;
 this.setClass = treeNodeSetClass;
 this.ondargstart = onTreeNodeDragStart;
 this.onUnselect = treeNodeOnUnselect;
}

function treeBranchToString()
{
 return "[tree branch]";
}

function treeNodeGetIndex()
{
 var index = 0;
 var p = this.parent;
 var i;
 for(i=0;i<p.length();i++)
 {
  if(p.nodes[i]==this)
  {
   index = i;
   break;
  }
 }
 return index;
}

function treeBranchExpand()
{
 var index = this.getIndex();
 this.tree.style.display='';
 this.TreeRow.style.display='';

 if(index==this.parent.length()-1)
 {
 this.img.src = "../images/minusL.gif";
 }
 else
 {
 this.img.src = "../images/minus.gif";
 }
 this.icon.src = this.openImg;
 this.opened=true;
}

function treeBranchClose()
{
 this.tree.style.display='none';
 this.TreeRow.style.display='none';

 var index = this.getIndex();

 if(index==this.parent.length()-1)
 {
 this.img.src = "../images/plusL.gif";
 }
 else
 {
 this.img.src = "../images/plus.gif";
 }
 this.icon.src = this.closeImg;
 this.opened=false;
}

function treeBranchExpandOrClose()
{
 if(this.opened==false)
 {
 this.expand();
 }
 else
 {
 this.close();
 }
 if(this.onExpandOrClose!=null)
 {
 eval(this.onExpandOrClose);
 }
}

function treeUnselect(p)
{
 if( (typeof(p.textSP)!="undefined") && (p.textSP!=null) )
 {
  p.onUnselect();
 }
 if( (typeof(p.nodes)!="undefined") && (p.nodes!=null) )
 {
  var i=0;
  for(i=0;i<p.nodes.length;i++)
  {
   treeUnselect(p.nodes[i]);
  }
 }
}

function treeBranchTextSPClicked()
{
 var p = null;
 p = this.parent;
 while((p.parent!=null)&&(typeof(p.parent)!="undefined"))
 {
  p = p.parent;
 }

 treeUnselect(p);

 this.textSP.parentNode.style.border="1px dotted #808080";

 this.selected = true;

 if(this.onTextSPClick!=null)
 {
  eval(this.onTextSPClick);
 }
}

function treeBranchSetClass(cnspan)
{
 this.subTree.cells[1].onmouseover = null;
 this.subTree.cells[1].onmouseout = null;
 this.subTree.cells[1].className = "";

 this.textSP.onmouseover = new Function("this.className='"+cnspan+"MouseOver';");
 this.textSP.onmouseout = new Function("this.className='"+cnspan+"MouseOut';");
 this.textSP.className = cnspan+"MouseOut";
}

function treeBranchSetText(text)
{
 this.text = text;
 this.textSP.innerHTML = text;
}

function treeBranchSetIcon(openImg , closeImg)
{
 this.openImg = openImg;
 this.closeImg = closeImg;
 if(this.opened == true)
 {
  this.icon.src = this.openImg;
 }
 else
 {
  this.icon.src = this.closeImg;
 }
}

function treeBranchClear()
{
 while(this.nodes.length>0)
 {
  this.delNode(0);
 }
}

function treeBranchOnUnselect()
{
 if( ( typeof(this.textSP)!="undefined" ) && ( this.textSP!=null ) )
 {
  if((typeof(this.textSP.parentNode)!="undefined")&&(this.textSP.parentNode!=null))
  {
   this.textSP.parentNode.style.border="";
   this.selected = false;
  }
 }
}

function treeBranch(text,openImg,closeImg,data,onExpandOrClose,onTextSPClick)
{
 this.text = text;
 this.data = data;
 this.openImg = openImg;
 this.closeImg = closeImg;


 this.opened = false;

 this.nodes = new Array();
 this.addNode = addTreeNode;
 this.addBranch = treeAddBranch;
 this.delNode = delTreeNode;
 this.length = treeGetLength;
 this.toString = treeBranchToString;
 this.expand = treeBranchExpand;
 this.close = treeBranchClose;
 this.ExpandOrClose = treeBranchExpandOrClose;
 this.TextSPClicked = treeBranchTextSPClicked;
 this.onExpandOrClose = onExpandOrClose;
 this.onTextSPClick = onTextSPClick;
 this.setClass = treeBranchSetClass;
 this.setText = treeBranchSetText;
 this.setIcon = treeBranchSetIcon;
 this.clear = treeBranchClear;
 this.getIndex = treeNodeGetIndex;
 this.onUnselect = treeBranchOnUnselect;

 this.tree = "";
 this.subTree = "";
 this.img = "";
 this.textSP = "";
}





调用代码及演示地址:
http://www.bqprog.com/HDOA/Main/Login.aspx
登录名称: admin
登录密码: admin

左栏菜单栏为演示

调用说明正在撰写中

深度学习是机器学习的一个子领域,它基于人工神经网络的研究,特别是利用多层次的神经网络来进行学习和模式识别。深度学习模型能够学习数据的高层次特征,这些特征对于图像和语音识别、自然语言处理、医学图像分析等应用至关重要。以下是深度学习的一些关键概念和组成部分: 1. **神经网络(Neural Networks)**:深度学习的基础是人工神经网络,它是由多个层组成的网络结构,包括输入层、隐藏层和输出层。每个层由多个神经元组成,神经元之间通过权重连接。 2. **前馈神经网络(Feedforward Neural Networks)**:这是最常见的神经网络类型,信息从输入层流向隐藏层,最终到达输出层。 3. **卷积神经网络(Convolutional Neural Networks, CNNs)**:这种网络特别适合处理具有网格结构的数据,如图像。它们使用卷积层来提取图像的特征。 4. **循环神经网络(Recurrent Neural Networks, RNNs)**:这种网络能够处理序列数据,如时间序列或自然语言,因为它们具有记忆功能,能够捕捉数据中的时间依赖性。 5. **长短期记忆网络(Long Short-Term Memory, LSTM)**:LSTM 是一种特殊的 RNN,它能够学习长期依赖关系,非常适合复杂的序列预测任务。 6. **生成对抗网络(Generative Adversarial Networks, GANs)**:由两个网络组成,一个生成器和一个判别器,它们相互竞争,生成器生成数据,判别器评估数据的真实性。 7. **深度学习框架**:如 TensorFlow、Keras、PyTorch 等,这些框架提供了构建、训练和部署深度学习模型的工具和库。 8. **激活函数(Activation Functions)**:如 ReLU、Sigmoid、Tanh 等,它们在神经网络中用于添加非线性,使得网络能够学习复杂的函数。 9. **损失函数(Loss Functions)**:用于评估模型的预测与真实值之间的差异,常见的损失函数包括均方误差(MSE)、交叉熵(Cross-Entropy)等。 10. **优化算法(Optimization Algorithms)**:如梯度下降(Gradient Descent)、随机梯度下降(SGD)、Adam 等,用于更新网络权重,以最小化损失函数。 11. **正则化(Regularization)**:技术如 Dropout、L1/L2 正则化等,用于防止模型过拟合。 12. **迁移学习(Transfer Learning)**:利用在一个任务上训练好的模型来提高另一个相关任务的性能。 深度学习在许多领域都取得了显著的成就,但它也面临着一些挑战,如对大量数据的依赖、模型的解释性差、计算资源消耗大等。研究人员正在不断探索新的方法来解决这些问题。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值