首页javascripttext_inputJavascript Form - 如何将文本输入字段中的输入转换为大写

Javascript Form - 如何将文本输入字段中的输入转换为大写

我们想知道如何将文本输入字段中的输入转换为大写。


<html> 
<head> 
<script type="text/javascript"> 
function upperMe(field) { 
    field.value = field.value.toUpperCase(); 
} 
</script> 
</head> 
<body> 
<form onsubmit="window.focus(); return false"> 
Lowercase letters:
<input type="text" name="converter" value="sample" onchange="upperMe(this)" /> 
</form> 
</body> 
</html>