日期:2014-05-18  浏览次数:20456 次

输入用户名,改变另一个按钮。解决方法??
有没有个解决方法。我是在page_load()时TextBox1.Attributes.Add( "onkeypress ", "....JS "),可是怎么也无法改变另一个按钮的状态。还是我写的有错?可能我写的JS有错吧。给个方法吧,用别的方法也行。

------解决方案--------------------
<input type=text onkeypress= "btn1.disabled=false; " />
<input type=button id=btn1 value=submit disabled />
------解决方案--------------------
按钮的enabled 是服务器属性吧?

你用JS 就应该设置disabled
------解决方案--------------------
TextBox1.Attributes.Add( "onkeypress ", "....JS ")

这是给服务器端控件添加客户端的属性...

例如:
我在服务器端的Page_load中写
TextBox1.Attributes.Add( "onkeypress ", "textPress ");
而在客户端写上
function textPress()
{
var a=$( "服务器端控件的ID ");
a.disabled=none;
}
------解决方案--------------------
没有区别:


TextBox1.Attributes.Add( "onkeypress ", " <script> document.getElementById( ' " + button1.ClientID + " ').disabled=true; " </script> "),