function LetterUpperCase(event, flag,obj)//keypress
{ if (flag) { var evt = event || window.event;var nKeyCode = evt.keyCode || evt.which;var sInput = obj.value;if (nKeyCode >= 65 && nKeyCode <= 90) { obj.value = sInput + String.fromCharCode(nKeyCode);return false;} else { return true;}}this.Attributes.Add("onkeydown", string.Format("return LetterUpperCase(event,{0},this);", this.UpperCase ? "true" : "false")); 会取消keypress事件
this.Attributes.Add("onkeydown", string.Format("LetterUpperCase(event,{0},this);", this.UpperCase ? "true" : "false")); 不会取消keypress事件