使用toLowerCase()让字母由小写转换成大写 和大写转小写

准备一个html页面
body内写

下面展示一些 。

<!--onblur 光标离开触发  onfocus 光标进入触发        -->
		大写字母:<input type="text" id="little" onblur="fun_1()" style="background-color: greenyellow;" /><br />
		小写字母:<input type="text" id="big"  style="background-color: aquamarine; color: red;"/>
		

然后js中写

function fun_1(){
				var str=document.getElementById("little").value;
				document.getElementById("big").value=str.toUpperCase();
				//str.toLowerCase()  转小写
			}

将小写字母成功转换
//toLowerCase() 是将大写转换为小写小写

猜你喜欢

转载自blog.csdn.net/NYHongHong/article/details/108978926