Maybe:
Code:
var maxTitle = 20;
for (x = 0; x < 5; x++)
{
var title = threads[x].title;
if (title.length > maxTitle )
{
title = title.substr(0,maxTitle-3) + "...";
}
document.writeln("<li><a href=\"showthread.php?t="+threads[x].threadid+"\">"+title+"</a><span>By: "+threads[x].poster+")</span><br /></li>");
}
But I'm not a JS expert and I didn't try that, so there could be some error in it.