首页 新闻 论坛 群组 Blog 文档 下载 读书 Tag 网摘 搜索 .NET Java 游戏 视频 人才 外包 培训 数据库 书店 程序员
中国软件网
欢迎您:游客 | 登录 注册 帮助
  • 帮忙啊找找哪里错了呀,谢谢
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于: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  修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-04-16 22:36:461楼 得分:0
    字符串双引号""中间不要换行。
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-05-01 05:02:192楼 得分:0
    好像没那么简单,呵呵.
    修改 删除 举报 引用 回复

    网站简介广告服务网站地图帮助联系方式诚聘英才English 问题报告
    世纪乐知(北京)网络技术有限公司 版权所有 京 ICP 证 020026 号
    Copyright © 2000-2007, CSDN.NET, All Rights Reserved