View Full Version : Find and replace code using javascript

05-04-2004, 12:01 PM
Hi there

Does any one know how set a javascript up to find and replace code in a text area.

I have form that summits content into my database and if you copy and paste strait from a word doc it submits all the word formatting into the database and then ignores the style applied to the text on the page that pulls it from the database.

I want to the script to check the content and replace any <p> tags that have word formatting code for html code. so that the text doesn't change in appearance.

so the word li tags are replaced, if i have to put exactly what it should find and replace it with then even better as i can replace font tags from word for the appropiate class tags for the style sheet.

I have read a few scripts where they have said us ^p as a find option but this simply wipes out the whole paragraghs formatting including any lists included.

Any help on this matter is most appreciated as i have no real idea where to start on this one. :confused: :confused: :confused:

05-04-2004, 02:51 PM
Look for Textism (http://www.textism.com) at the Wayback Machine (http://web.archive.org) and find an old page for the 'Word HTML Cleaner' - it's a php script that sanitizes Word HTML for the web. He used to have it available for download, but has since changed to a subscription basis for use online. Bummer.