<html> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <head> <style> </style> <link rel=stylesheet href="style.css" type="text/css"> <script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script> <style type="text/css"> *{ margin: 0; padding: 0; } body{ font-size: 40px; } .title{ display: none; } .nr{ width: 519px; height: 195px; background-color: #ffffff; box-shadow: 1px 1px 15px 0px rgba(0, 0, 0, 0.1); border-radius: 20px; margin: 0 auto; } span{ display: block; width: 100%; height: 40px; line-height: 40px; text-align: center; font-weight: 800; } .word{ padding-top: 27px; /* text-transform: capitalize; */ } </style> </head> <body> <div class=title>L</div> <div class=nr><span class=word>Lion</span> <span class=fanyi>狮子</span></div><br> <div class=nr><span class=word>Log</span> <span class=fanyi>圆木</span></div><br> </body> <script type="text/javascript"> $(".word").hide(); var html = $(".word").html(); var ss = html.split("");// 在每个逗号(,)处进行分解。 console.log(ss) $(".word").html(''); var spanBq = '<lable class style="margin-right:10px;color:#ff0000;">'+ ss[0] +'</lable>'; $(".word").append(spanBq); var list = []; for (var i=0;i<ss.length;i++){ console.log(ss[i],'273') if(i>0){ var obj = ss[i] list.push(obj); } } console.log(list.toString().replace(/[\ |\~|\`|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\-|\_|\+|\=|\||\\|\[|\]|\{|\}|\;|\:|\"|\'|\,|\<|\.|\>|\/|\?]/g,""),'273'); var aa = list.toString().replace(/[\ |\~|\`|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\-|\_|\+|\=|\||\\|\[|\]|\{|\}|\;|\:|\"|\'|\,|\<|\.|\>|\/|\?]/g,""); $(".word").append(aa); $(".word").show(); </script> </html>