Use a checkbox to convert text in an input field to uppercase:
<!DOCTYPE html> <html> <body> <form> First Name: <input type="text" id="fname" value="Donald"> <br><br> Convert to upper case/* www. j ava 2 s . co m*/ <input type="checkbox" onclick="if(this.checked){myFunction()}"> </form> <script> function myFunction() { document.getElementById("fname").value = document.getElementById("fname").value.toUpperCase(); } </script> </body> </html>