W3School TIY
编辑您的代码:
<html> <body> <script type="text/javascript"> name = 'aaa bbb ccc'; uw=name.replace(/\b\w+\b/g, function(word){ return word.substring(0,1).toUpperCase()+word.substring(1);} ); document.write (uw); </script> </body> </html>
查看结果: