日期:2014-05-17  浏览次数:20641 次

js问题,急求大神解决
比如获得一个字符串为“How are you doing today” 怎样把每个空格之间的单词添加到一个集合 
求大神


------解决方案--------------------
String[] s = “How are you doing today”.split(" ");
------解决方案--------------------
JScript code

<script type="text/javascript">
        var str = "How are you doing today";
        var strAry = new Array;
        strAry = str.split(" ");  
        alert(strAry);
</script>

------解决方案--------------------
JScript code

<script>
        var s = "how are you";
        var vs = s.split(" ");
        for(var i = 0; i < vs.length; i++){
            alert(vs[i]);
        }
    </script>