Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] js for inserting a \n every 80 chars?


  • From: wdlists at triche-osborne.com (Triche Osborne)
  • Subject: [Javascript] js for inserting a \n every 80 chars?
  • Date: Fri Dec 29 12:00:32 2006

LIFO:
Matt Murphy wrote:
>  
> Is there somewhere I can go to look up javascript functions?

http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide

> Is there a javascript version of str_replace()?
>
string.replace( regexp, replacement )

> I have a script that takes user input from a textarea and dumps it into
> a <pre> element in a new table cell. The problem is if you type in a
> long sentance with no breaks, the <pre> will not allow it to wrap, and
> it'll make the table super wide. I'm wondering if there's a javascript
> function that will allow me to insert a \n every 80 characters? 
>  

Not built-in, no. If you build your own, you may want to refine it so 
that it breaks on the nearest space rather than exactly at 80.

Triche