JavaScript分割字符串

<script language="javascript">
function OnCall() {
	var aaa = "1|aaa|2|bbb|3|ccc|4|ddd|";
	var bbb = aaa.split("|");
	var count = (bbb.length - 1) / 2;
	for (var i = 0; i <= count; i++) {
		document.all("DropDownList2").options.add(new Option(bbb[i], bbb[i + 1]));
	}
	return;
}
<script>

你可能感兴趣的:(JavaScript)