input输⼊框输⼊⼩写字母⾃动转换成⼤写字母input输⼊框输⼊⼩写字母⾃动转换成⼤写字母有两种⽅法
1.⽤js onkeyup事件,即时把字母转换为⼤写字母:
html⾥input加上
<input type="text" id="txt1" value="" onkeyup="toUpperCase(this)"/>
input框禁止输入js写函数
function toUpperCase(obj)
{
obj.value = UpperCase()
}
这种⽅法虽然可以,但是输⼊汉字的时候会受到⼲扰,还有⼀种更好的⽅法
加css
<input type="text" id="txt1" value="" />

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。