心烦了,不同的.NET配置DataList中的绑定控件生成的HTML控件ID还不同啊!!!
用下面的DataList绑定一个TextBox
<asp:DataList RepeatColumns="5" ID="DLChinese" Visible="false" runat="server" CellPadding="0" CellSpacing="40" ItemStyle-HorizontalAlign="left">
<ItemTemplate>
<asp:TextBox runat="server" ID="txtInput" /></span>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
</asp:DataList>
页面执行后:
在空间服务器上是这样的HTML代码
<input name="DLChinese$ctl00$txtInput" type="text" id="DLChinese_txtInput_0" />
在我的本机上是这样的HTML代码
<input name="DLChinese$ctl05$txtInput" type="text" id="DLChinese_ctl05_txtInput" />
FUCK,ID变了!!!!!
那不是客户端用到javascript getElementById函数的代码全部都出错了,怎么会这样?!!