有没有其它办法去触发TextBox的TextChanged事件?
TextBox的TextChanged事件,必顺在内容改变后,焦点移出TextBox,才会触发,有没有其它办法触发?
<script type= "text/javascript ">
function aaa()
{
document.form1.TextBox1.value=document.form1.Text1.value;
}
</script>
<form id= "form1 " runat= "server ">
<div>
<asp:TextBox ID= "TextBox1 " runat= "server " OnTextChanged= "TextBox1_TextChanged " AutoPostBack= "True "> </asp:TextBox>
<br>
<input id= "Text1 " onkeyup= "aaa() " type= "text " runat= "server " />
</div>
</form>
------解决方案--------------------例如,你可以在 page_load 中写:
this.TextBox1.Attributes[ "onkeyrpess "] = "if(this.value.length> =13) " +
this.Page.ClientScript.GetPostBackEventReference(this.TextBox1, " ");
------解决方案-------------------- <script type= "text/javascript ">
function aaa()
{
document.form1.TextBox1.value=document.form1.Text1.value;
__doPostBack( 'TextBox1 ', ' ');
}
</script>
------解决方案--------------------1.还可以设置光标位置
Text1.focus()没有起到作用,不太清楚,放在JS中设吧
2.IE 选项
禁用脚本调试(IE)
禁用脚本调试(其它)
把钩去了
例如:
private bool IsNumber(string str)
{
debugger;//在这加上这句,就行了
string num = "0123456789 ";
for(int i=0;i <str.Length;i++)
{
if(num.IndexOf(str.Substring(i,1)) == -1)
return false;
}
return true;
}