thxuaimin

导航

 
1 <mce:script type="text/javascript"><!--
2     $(document).ready(function () {
3         $('a').click(function () {
4             var array = ("").split(",");
5             document.writeln("数组长度:" + array.length);
6             document.writeln("数组值:"+array[0]);
7         });
8     });
9 // --></mce:script>

当字符串为空的情况下,使用逗号',',来分割,结果返回数组的长度为1,数组值是空;

posted on 2014-03-14 17:28  thxuaimin  阅读(270)  评论(0编辑  收藏  举报