onkeyup 事件会在键盘按键被松开时发生
<html>
<head>
<script type="text/javascript">
function upperCase(x)
{
var y=document.getElementById(x).value
document.getElementById(x).value=y.toUpperCase()
}
</script>
</head>
<body>
输入您的姓名: <input type="text" id="fname" onkeyup="upperCase(this.id)"
/>
</body>
</html>