Javascript 字符串统计+小写转大写+首字母大写

<html lang="en"> 
<head> 
    <title>字符串统计+小写转大写</title> 
    <script> 
        function Prompt(){
            var content = prompt("输入数据类型:String","");
            document.getElementById("result").innerHTML = "<font color = 'red'> 输入的内容: </font>"+content.big()
            +"<br/><br/>"+"<font color = 'green'> 输入的内容的个数: </font>"+content.length+"<br/><br/>"
            +"<font color = 'blue'> 输入的内容转换为大写: </font>"+content.toLocaleUpperCase()
            +"<br/><br/>"+"<font color = 'red'> 输入的内容首字母大写: </font>"+content.substr(0,1).toLocaleUpperCase()+content.substr(1)
            ;
            
        }

    </script> 
</head> 
<body> 
<center>
<h3>字符串统计+小写转大写</h3>
<div id = "result"></div>
    <br/>
    
    <button onclick = "Prompt()">输入数据</button>
</center>
</body> 
</html>

截图:
![图片描述][1]

本文转载于:猿2048https://www.mk2048.com/blog/blog.php?id=hii121ck2kj

猜你喜欢

转载自www.cnblogs.com/baimeishaoxia/p/12642301.html