How to upper letters while you're typing

Hi, I tried to upper the letters while the user is typing in a textbox.

<SCRIPT language="javascript">
function Upper(e,r)
   if (e.keyCode > 96 && e.keyCode < 123)
         r.value = r.value.toUpperCase();

 txtTextBox1.Attributes.Add("onKeyPress", "javascript:return Upper(event,this);")

But it doesn't never change the last letter. For example, it shows: "I WRITE THIS MESSAGe"
What am I missing, please?
Who is Participating?
GwynforWebConnect With a Mentor Commented:
this works fine

<input type="text" onkeyup ="this.value=this.value.toUpperCase()">
Not sure, but try "onKeyUp" instead of "OnKeyPress".
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.