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();
 }
</SCRIPT>

 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?
Juan_BuendiaAsked:
Who is Participating?
 
GwynforWebConnect With a Mentor Commented:
this works fine


<input type="text" onkeyup ="this.value=this.value.toUpperCase()">
0
 
ziffgoneCommented:
Not sure, but try "onKeyUp" instead of "OnKeyPress".
0
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.