/**************************************************************************************************************************
方法  : mylist_ListView 列表控件
参数  : container 父容器,vs_title 标题
**************************************************************************************************************************/
function mylist_ListView(container,vs_title){
    this.Container = container; //容器
    this.Values = new ActiveXObject("Scripting.Dictionary"); 
    this.SelectedIndex = -1;    //选择指定行
     this.SelectItem = function(){
    if (this.SelectedIndex < 0)
        return;
    var vo_tr = this.TB.rows[this.SelectedIndex];
    if (vo_tr != null){
        vo_tr.className = "menu_Select";
            mylist_Config.CurItem = vo_tr.tag;
            mylist_Config.CurTr = vo_tr;
        }
     }

     //选择列表
      this.TB.onmousedown = function(){
        var vo_tr = window.event.srcElement;
        if(vo_tr.tagName == "TABLE")
            return;
        while(vo_tr.tagName != "TR"){
            vo_tr = vo_tr.parentElement;
            if(vo_tr.tagName == "TABLE")
                return;
        }        if(mylist_Config.CurTr != null)
            mylist_Config.CurTr.className = "menu_UnSelect";
        this.SelectedIndex = vo_tr.rowIndex;    
        this.SelectItem();    
    }
    
}
红色标准部分是调用方法的部分,提示“对象不支持此属性或方法”

解决方案 »

  1.   

    //选择指定行 
        this.SelectItem = function(){ 
        if (this.SelectedIndex < 0) 
            return; 
        var vo_tr = this.TB.rows[this.SelectedIndex]; 
        if (vo_tr != null){ 
            vo_tr.className = "menu_Select"; 
                mylist_Config.CurItem = vo_tr.tag; 
                mylist_Config.CurTr = vo_tr; 
            } 
        } 
      
      改成 function SelectItem(){
              ....
           }
     
       试试
      

  2.   

    这么多this,请注意this指代的对象!
      

  3.   

    这样是行的,但是如果我的SelectItem方法里需要调用控件的属性的话,就无法用this.SelectedIndex这样取得了,只能通过参数了!能否告知为什么无法调用自己的方法?