2015-10-08 59 views
1

我要访问的aSubchapter JavaScript文件中,我应该要做找到隐藏文件的代码动态创建的元素?(本页内容是页)如何通过使用JavaScript

中的.aspx

.cs文件

protected void page_load() 
{ 
    HtmlGenericControl aSubchapter=new HtmlGenericControl("a"); 
    aSubchapter.Attributes.Add("href","somevalue"); 
    aSubchapter.ID="subchapter"; 
} 

在.aspx文件

<script type="text/javascript"> 
    var subchap=document.getElementById('<%=subchapter.ClientID%>'); 
    //(The above lines says that subchap is undefined) 
</script> 

回答