在javascript中如何获取用户控件里的子控件的值

<script type="text/javascript">
function   GetItem()  
  {   
        //如何是TextBox则是value,如何是Label则是innerHTML有事是innerTEXT;        
        //(<%@ Register Src="User_Controls/WebUserControl.ascx"     TagName="WebUserControl"      TagPrefix="uc1"     %>);
        //WebUserControl1是用户控件id    
        //LType是用户控件里的子控件id
        //方法1

        var   opts   =   document.getElementById("WebUserControl1_LType").value;
        alert(opts)
        
        //方法2
        alert(document.getElementById("<%= WebUserControl1.FindControl("LType").ClientID %>").value);
  }
</script>

posted on 2008-02-27 13:31  秋天  阅读(1947)  评论(1编辑  收藏  举报

导航