我有一個<script>
包含此行:ASP.NET:爲什麼我的JavaScript對象設置爲null?
var tbl = document.getElementById("<%= this.tblSelection.ClientID %>");
...但tbl
最終總是被設置爲null
。
表聲明如下:
<asp:Table ID="tblSelection" runat="server" CellPadding="2" CellSpacing="0"
cols="1" style="position: absolute; top: 0%; right: 0%">
無論是腳本和表是在同一個母版頁的文件。
這可能是什麼原因造成的?
編輯:我應該指出,這個腳本是在onload
腳本在你的表之前或之後的頁面中? – 2010-04-29 17:57:19
腳本在頭部,表在身體。頭先到。 – Giffyguy 2010-04-29 18:00:07