In the system, there is a text box that requires a capital letter to be entered. But the user unconsciously, had to control in the program.
In the Web page, pull a TextBox control:
Copy Code code as follows:
<asp:textbox id= "Textboxseriesnumber" runat= "Server" ></asp:TextBox>
Write JavaScript scripts, you can use the onkeyup event to instantly convert letters to uppercase letters:
Copy Code code as follows:
<script type= "Text/javascript" >
Window.onload = function () {
var TextBox = document.getElementById ("<%= textboxseriesnumber.clientid%>");
Textbox.onkeyup = function () {
This.value = This.value.toUpperCase ();
};
};
</script>
Demo:
The following is added at 15:08:
The problem with the above method is to show the lowercase letters first, and then turn to uppercase letters. Find other information on the Internet, and inadvertently sent a better way, is to use CSS to achieve:
Style= "Text-transform:uppercase;"
The full application is as follows:
For a description of the Text-transform style properties: