用javascript数组处理多个字符串的连接。
例1,
复制代码 代码示例:
<script language="javascript">
var str = new Array();
str[0] = '<li id="domain-{0}">'.replace('{0}', 'domainid');
str[1] = 'domainname';
str[2] = '<input type="hidden" name="domainids" value="{0}">'.replace('{0}', 'domainid');
str[3] = '</li>';
alert(str.join(''));
</script>
例2,
复制代码 代码示例:
<script language="javascript">
var str2 = [
'<li id="domain-{0}">'.replace('{0}', 'domainid'),
'domainname',
'<input type="hidden" name="domainids" value="{0}">'.replace('{0}', 'domainid'),
'</li>'
];
alert(str2.join(''));
//edit www.jb200.com
</script>