StringBuilder Javascript
function StringBuilder(value){
this.strings = new Array("");
this.append(value);
}
StringBuilder.prototype.append = function (value){
if (value)this.strings.push(value);
}
StringBuilder.prototype.clear = function (){
this.strings.length = 1;
}
StringBuilder.prototype.toString = function (){
return this.strings.join("");
}
var sb = new StringBuilder()
sb.append( "<table width='100%' border=0 cellspacing=0 cellpadding=0 background=\"/images/sep_list.gif\" class=\"font_list\" style=\"padding-left:10px\">");
sb.append( "<tr><td width='1%' align=left>");
sb.append(i+1);
sb.append("</td><td align='left' width='50%'>");
sb.append(createLink(book,linkType));
sb.append("</td> <td width=15 width='1%' align=left class=wz38>┊</td> <td width=80 width='39%' align='left' >");
sb.append("<a href='/Author/");
sb.append(book.AuthorId); //authorId
sb.append(".aspx");
sb.append("' target='_blank' class='green' title='作者:");
sb.append(book.AuthorName+"'>"); //authorname
sb.append(formatAuthor(book.AuthorName)+"</a>");
sb.append("</td></tr>");
sb.append("</table>");
return sb.toString();
浙公网安备 33010602011771号