PDA

View Full Version : Limiting the number of characters in this script?


ggiersdorf
10-02-2009, 02:41 PM
Hi Im using a javascript to display my most recent forum posts on a non-vbulletin page everything is working however I wanted to know if anyone would know a way to limit the number of characters displayed on the out put to an (X) value?

As it stands now if someone writes a post thats long titled it will mess up the formatting of my table. So I would like to set the characters displayed for each post to like 60 characters or something.

Here is the code Im using below:

<script type="text/javascript" src="http://www.website.com/forum/external.php?&type=js&lastpost=1"></script>
<script language="" type="text/javascript">
<!--
for (x = 0; x < 5; x++)
{
document.writeln("-<a href=http://www.website.com/forum/showthread.php?t="+threads[x].threadid+">"+threads[x].title+"</a><br />");
}
//-->
</script>

thanks in advance.