<html>
<body>
<form>
名字:<input type="text" id="fname" value="Bill">
<br><br>
转换为大写
<input type="checkbox" onclick="if(this.checked){myFunction()}">
</form>
<script>
function myFunction() {
document.getElementById("fname").value = document.getElementById("fname").value.toUpperCase();
}
</script>
</body>
</html>