直接上代码:this.setxzqh = function (msg) {
        $("#xzqhtree").html("");
        //$("#xzqhtree").height((this.rightheight - 30) + "px");
        $("#xzqhtree").html(msg.d);
        $("#xzqhtree").jstree({
            "themes": {
                "theme": "classic",
                "dots": true,
                "icons": false
            }, "plugins": ["themes", "html_data", "ui"]
        })
            .bind("select_node.jstree", function (event, data) {
                var num = data.rslt.obj.attr("id");
                this.dqxzqh = num;
                this.dqxzqhmc = $("#xzqh" + num).html();
                postAjax("../service/app.asmx/getxq", "{xqid:'" + num + "',checkedid:'0'}", showxq);
            })
    .delegate("a", "click", function (event, data) {
        event.preventDefault();
    });
        //        $("#xqgltreeLoad").hide(100);
        //        $("#xqgltreeLoad1").hide(100);
    };在这里红色的 dqxzqh和dqxzqhmc ,是这个类当中的属性,本来可以用this.来访问的,但是代码加入 jquery当中,this就变成其他对象了,请教高手,该如何写,才能访问 dqxzqh和dqxzqhmc 的属性

解决方案 »

  1.   


    this.setxzqh = function (msg) {
    var that = this;
            $("#xzqhtree").html("");
            //$("#xzqhtree").height((this.rightheight - 30) + "px");
            $("#xzqhtree").html(msg.d);
            $("#xzqhtree").jstree({
                "themes": {
                    "theme": "classic",
                    "dots": true,
                    "icons": false
                }, "plugins": ["themes", "html_data", "ui"]
            })
                .bind("select_node.jstree", function (event, data) {
                    var num = data.rslt.obj.attr("id");
                    that.dqxzqh = num;
                    that.dqxzqhmc = $("#xzqh" + num).html();
                    postAjax("../service/app.asmx/getxq", "{xqid:'" + num + "',checkedid:'0'}", showxq);
                })
                .delegate("a", "click", function (event, data) {
                    event.preventDefault();
                });
            //        $("#xqgltreeLoad").hide(100);
            //        $("#xqgltreeLoad1").hide(100);
        };试试
      

  2.   

    在这里红色的 dqxzqh和dqxzqhmc ,是这个类当中的属.  直接使用类名调用.