<script language="javascript">
var str = "1,2,3,4,5,6,7";
var strArray = new Array(); //定义一数组
strArray = str.split(","); //分割
for (i=0; i<strArray.length; i++)
{
document.write(strArray[i]+"<br/>");
}
</script>
<script language="javascript">
var str = "1,2,3,4,5,6,7";
var strArray = new Array(); //定义一数组
strArray = str.split(","); //分割
for (i=0; i<strArray.length; i++)
{
document.write(strArray[i]+"<br/>");
}
</script>
转载于:https://my.oschina.net/jirglt/blog/3010887