連接:https://www.cnblogs.com/chenlove/p/8818067.htmljavascript
(侵刪)html
<script language="javascript"> str="2,2,3,5,6,6"; //這是一字符串 var strs= new Array(); //定義一數組 strs=str.split(","); //字符分割 for (i=0;i<strs.length ;i++ ) { document.write(strs[i]+"<br/>"); //分割後的字符輸出 } </script>