输入字母自动变成大写:
<script type="text/javascript">
function forceInputUppercase(e)
{
var start = e.target.selectionStart;
var end = e.target.selectionEnd;
e.target.value = e.target.value.toUpperCase();
e.target.setSelectionRange(start, end);
}
document.getElementById("field1").addEventListener("keyup", forceInputUppercase, false);
document.getElementById("field2").addEventListener("keyup", forceInputUppercase, false);
</script>