readonly,disabled是input的属性
ReadOnly,Enabled是asp:TextBox的属性
要求: 客户端不能输入,但可通过js赋值,并在服务器端获取到js赋的值
前台:
<asp:TextBox ID="TextBox1" runat="server" ReadOnly="true" Enabled ></asp:TextBox>
<input id="Text1" runat="server" type="text" readonly="readonly" />
<input id="Button1" type="button" value="客户端赋值" onclick="doClick()" />
<asp:Button ID="Button2" runat="server" Text="服务器端获取" OnClick="Button2_Click" />
<script language="javascript">
function $(s){return document.getElementById(s);}
function doClick()
{
$('<%=Text1.ClientID %>').value="wufeng";
$('<%=TextBox1.ClientID %>').value="wufeng";
}
</script>文章来源于 http://www.cnblogs.com/wf225 版权归原作者所有



1874

被折叠的 条评论
为什么被折叠?



