HTML Cleaner

How many of you needed to clean up those messy MS Word files in order to integrate them into valid W3C pages, or just integrate them in the overall design ?
I’ve looked for a good HTML Cleaner and did’t find a good free one.
Meanwhile, I’ve developed my own HTML Cleaner class in PHP, because I [...]

javascript isset()

Have you ever wanted to test the existance of a javascript variable
(an array item for example) ?
Just like in PHP, I’ve found a method to do this.
The function returns true if the variable is set or false if the variable was not set.
A variable to be set must be initialized.
The starting point was that an [...]

javascript nl2br

After many torments while finding a working nl2br() javascript function, i came accross this idea…
For those that are not familiar with the nl2br function from PHP, this simply converts regular line breaks (carriage return ASCII characters) to HTML breaks.
The function converts to XHTML format: <br />
Here is the code:

function nl2br(text){
text=escape(text);
return unescape(text.replace(/(%5Cr%5Cn)|(%5Cn%5Cr)|%5Cr|%5Cn/g,‘<br />’));
}
 
The function uses regular [...]