<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
input:focus{
background-color:yellow ;
}
</style>
</head>
<body>
<div>
<p>请输入英文字母:<input type="text" onchange="myFunction()" id="fname" value="" /></p>
<script type="text/javascript">
function myFunction() {
var x=document.getElementById("fname");
x.value=x.value.toUpperCase();
}
</script>
</div>
</body>
</html>