script language="javascript" type="text/javascript"
function NumberText()
{
if(!(((window.event.keyCode>=48)&&(window.event.keyCode<=57))||(window.event.keyCode==13)||(window.event.keyCode==46)||(window.event.keyCode==45)))
{
window.event.keyCode=0;
}
}
/script
2.textbox內
asp:TextBox ID="txtInputChtno" onkeypress="NumberText()" runat="server"
3.aspx.cs後端程式碼 事件內(ex: PageLoad)
txtInputChtno.Attributes.Add("onkeypress", "NumberText()");
沒有留言:
張貼留言