• 首页
  • 小学语文
  • 中学语文
  • 中学英语
  • 免费论文
  • 教学随笔
  • 学生作文
  • 综合考试
  • 试题教案
  • 育儿话题
  • 教学资源
  • 编程技术
  • 博客
  • 关于javascript树形结构的编写问题

    日期:2003-03-08  地址:  作者:

    function branch(id, text){
    this.id = id;
    this.text = text;
    this.write = writeBranch;
    this.add = addLeaf;
    this.leaves = new Array();
    this.getid=getid;
    }
    function getid(){return this.id;}

    function addLeaf(leaf){
    this.leaves[this.leaves.length] = leaf;
    }

    function writeBranch(){
    var branchString =
    '< span class="branch" ' + onClick="showBranch(this.getid())"';

    //编译的时候出现了this.getid()必须要赋予一个变量的问题,也就是左值问题

    求教!!!!!!!!
    branchString += '>< img src="plus.gif" id="I' + this.id + '">' + this.text;
    branchString += '< /span>';
    branchString += '< span class="leaf" id="';
    branchString += this.id + '">';
    var numLeaves = this.leaves.length;
    for (var j=0;j< numLeaves;j++) branchString += this.leaves[j].write();
    branchString += '< /span>';
    return branchString;
    }

    对 关于javascript树形结构的编写问题 文章的评论    [查看网友评论]

    验证码:
    匿名发表: