<html>
<head>
<title>字符串切分</title>
<script language=javascript>
function getmulti(oldstr) {
var newstr=oldstr;//字段內容
var i=
var foreindex;//記錄前一個分隔符的位置
var index
var linkstr=
var astr = new Array(
var index
var index
var index
var index
var index
var index
function LTrim(str) {
for (var x=
return str
}
if(index
index=index
depchar=
}
else if(index
index=index
depchar=
}
else if(index
index=index
depchar=
}
else if(index
index=index
depchar=
}
else if(index
index=index
depchar=
}
else if(index
index=index
depchar=
}
else{
t=
linkstr=
}
foreindex=
while (index !=
index = newstr
if(index==foreindex) {foreindex=index+
if(index!=
astr[j]=newstr
astr[j]=LTrim(astr[j]);
foreindex=index+
j=j+
}
}
astr[j]=newstr
if(t==
{
for(i=
{
linkstr=linkstr+
}
}
return linkstr;
}
</script>
</head>
<body>
<script language=javascript>
var linkstring=
var tmpkeyword=
linkstring=getmulti(tmpkeyword);
document
</script>
</body>
</html>
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19539.html