Automatic line break?

liunx

Guest
I'm not sure if i put this in the right forum, since my comments page uses PHP, but this is likely to be a HTML problem. ok say somebody desides to spam my comments page, with just a continous long line off mixed up letters with no spaces, how would i automatically make the line break up? (a bit like a <*br> but i dont have any control over what is put within the comment, so i need it to automatically break at a certain amount of letters or something like that).<!--content-->You could so something like this:<br />
<br />
<br />
<form name="feedback" onsubmit="insertBR()"><br />
<textarea name="comments"><br />
</textarea><br />
<br />
<input type="submit" value="submit"><br />
</form><br />
<br />
<br />
<script language="javascript"><br />
function insertBR(){<br />
var txt = document.feedback.comments;<br />
var txtAry = txt.split(" ");<br />
for (var i=0;i<txtAry.length;i++){<br />
if (txtAry.length > 20){<br />
var txtAry = txtAry.substring(0,20)+"<BR>"+txtAry.substring(20);<br />
}<br />
}<br />
document.feedback.comments = txt;<br />
return true;<br />
}<br />
</script><!--content-->
 
Back
Top