字符串分割存入字符数组
我有这样一个字符串 "123456 "
如何将他们分割成1 2 3 4 5 6这样单个的然后存入数组中
var num_array=new Array()
num_array[0]=1;
.
.
.
.
num_array[6]=6;
谢谢!
------解决方案--------------------var a= "123456 ";
var num_array=new Array()
num_array=a.split( " ");
------解决方案-------------------- <script language= "JavaScript ">
<!--
var a = "123456 ".split( " ");
for (var i = 0; i < a.length; i++){
alert(a[i]);
}
//-->
</script>