-

- 加为好友
- 发送私信
- 在线聊天
|
| 发表于:2008-04-16 22:30:04 楼主 |
var imgpath=["img/plus.gif","img/minus.gif","img/dot.gif"] function dtree(obj,target,check) { this.obj=obj this.target=target this.child=0 this.node=0 this.icon=[] this.showcheck=check this.html=" <table id='deeptree' onselectstart='return false' cellspacing=0 cellpadding=0 border=0>" for(i=0;i <imgpath.length;i++) { var tem=new image() this.icon[i]=tem.src=imgpath[i]} } dtree.prototype.addfolder=function(txt,link,show) { this.msg[this.node]=[txt,link?link:''] this.html+=" <tr> <td class='node'> <img src='"+(show?this.icon[1]:this.icon[0])+"' id='img"+this.child+"' border=0 align='absmiddle' onclick='"+this.obj+".expand("+this.child+")'> <input type='checkbox' name='treefolder' onclick='"+this.obj+".checkall(this,"+this.child+")' style='display:"+(this.showcheck?'':'none')+"'> <span onmouseover='doover(this)' onmouseout='doout(this)' onmousedown='"+this.obj+".light(this,"+this.node+");" +this.obj+".expand("+this.child+")' title='"+txt+"'>"+txt+" </span> </td> </tr> <tr id='child"+this.child+"' style='display:"+(show?'':'none')+"'> <td class='node'>" this.html+=" <table cellspacing=0 cellpadding=0 border=0 style='margin-left:18;'>" this.child++ this.node++; } dtree.prototype.addnode=function(txt,link) { this.msg[this.node]=[txt,link?link:''] this.html+=" <tr> <td class='node'> <img src='"+this.icon[2]+"' align='absmiddle' onclick='"+this.obj+".light(this.nextsibling.nextsibling,"+this.node+")'> <input type='checkbox' name='treenode' onclick='"+this.obj+".parentcheck(this)' style='display:"+(this.showcheck?'':'none')+"'> <span onmouseover='doover(this)' onmouseout='doout(this)' onmousedown='"+this.obj+".light(this,"+this.node+")' title='"+txt+"'>"+txt+" </span> </td> </tr>" this.node++; } dtree.prototype.endfolder=function() { this.html+=" </table> </td> </tr>"} dtree.prototype.expand=function(childnum,flag) { var isexpand=document.getelementbyid("child"+childnum).style.display document.getelementbyid("img"+chilenum).src=isexpand=='none'?this.icon[1]:this.icon[0] document.getelementbyid("child"+chilenum).style.display=isexpand=='none'?'':'none'} dtree.prototype.expandall=function(flag) { if(this.child>0) for(i=0;i <this.child;i++) { document.getelementbyid("img"+i).src=flag?this.icon[1]:this.icon[[0] document.getelementbyid("child"+i).style.display=flag?'':'none'}} dtree.prototype.checkall=function(obj,childnum) { obj.blur() var child=document.getelementbyid("child"+childnum) var nod=child.getelementsbytagname("input") for(i=0;i <node.length;i++)node[i].checked=obj.checked this.parentcheck(obj) } dtree.prototype.parentcheck=function(obj) { obj.blur() for(i=this.chile-1;i>=0;i--) { var checkparent=true var c=document.getelementbyid("child"+i) var node=c.getelementsbytagname("input") for(j=0;j <node.length;j++)if(!node[j].checked)checkparent=false document.getelementbyid("img"+i).nextsibling.checked=checkparent}} dtree.prototype.getcheckedvalue=function() { var valve[] var nod=document.getelementbyid('deeptree').getelementsbytagname("input") for(i=0;i <node.length;i++)if(node[i].checked&node[i].name=="treenode")value[value.length]=this.msg[i][0] return value} dtree.prototype.init=function() { this.html+=(this.node>0?"":" <tr> <td>暂时没有数据 </td> </tr>")+" </table>" document.write(this.html)} var tem=null function doover(o){ o.classname='nodeover'} function doout(o) { o.classname=(tem==o?'nodefocus':'')} dtree.prototype.light=function(o,nodenum) { if(!tem)tem=o tem.classname='' o.classname='nodefocus' tem=o if(this.msg[nodenum][1])window.open(this.msg[nodenum][1],this.target);} 总是显示19行,36个字符,错误,未结束的字符串常量,是怎么回事,大家给看看 |
|
|
|
20
修改
删除
举报
引用
回复
| |