Log in

View Full Version : change special html characters in forms



d-machine
07-14-2008, 12:01 PM
hi

I have a simple form, which includes a textarea.
The text that the visitor put into the textarea is being print in my site.
Sometimes the visitors write signs as " or <

can I change those signs while sending the form or while it is being print in my site, to the appropriate xhtml vaild codes?

Thanks

allahverdi
07-14-2008, 12:11 PM
use replace().
like:

myobject.replace(/</, "&alt");

Between // is something that we will replace. After it, replace that with this. I think I could help you. If you didn't understand me search in google "javascript replace" or something like that...

d-machine
07-14-2008, 12:20 PM
Thank you!!!!! ;)