简单教程
提交运行
代码编辑器:
<script> function displayResult(){ document.getElementById("p1").style.textTransform="capitalize"; } </script> <p id="p1">This is some text.</p> <br> <button type="button" onclick="displayResult()">转换文本首字符为大写</button>
运行结果: