Web Development
 
Your Ad Here
Clean our odd characters pasted from word to form fields (javascript version) 
Here is the javascript version to clean out odd characters pasted from word into form fields:

function html_fix(html) {

html = html.replace(/<\\?\?xml[^>]*>/ig,"");
html = html.replace(/<\/?o:p[^>]*>/ig,"");
html = html.replace(/<\/?v:[^>]*>/ig,"");
html = html.replace(/<\/?o:[^>]*>/ig,"");
html = html.replace(/<\/?st1:[^>]*>/ig,"");
html = html.replace(/ /ig,"");
html = html.replace(/<\/?SPAN[^>]*>/ig,"");
html = html.replace(/<\/?FONT[^>]*>/ig,"");
html = html.replace(/<BR[^>]*>/ig,"<BR />");
html = html.replace(/<P[^>]*>/ig,"");
html = html.replace(/<\/P[^>]*>/ig,"<BR />");
html = html.replace(/<![^>]*>/ig,"");
html = html.replace(/¡/g,"¡");
html = html.replace(/¤/g,"¤");
html = html.replace(/¢/g,"¢");
html = html.replace(/£/g,"£");
html = html.replace(/¥/g,"¥");
html = html.replace(/¦/g,"¦");
html = html.replace(/§/g,"§");
html = html.replace(/¨/g,"¨");
html = html.replace(/©/g,"©");
html = html.replace(/ª/g,"ª");
html = html.replace(/«/g,"«");
html = html.replace(/¬/g,"¬");
html = html.replace(/­/g,"­");
html = html.replace(/®/g,"®");
html = html.replace(/™/g,"™");
html = html.replace(/¯/g,"¯");
html = html.replace(/°/g,"°");
html = html.replace(/±/g,"±");
html = html.replace(/²/g,"²");
html = html.replace(/³/g,"³");
html = html.replace(/´/g,"´");
html = html.replace(/µ/g,"µ");
html = html.replace(/¶/g,"¶");
html = html.replace(/·/g,"·");
html = html.replace(/¸/g,"¸");
html = html.replace(/¹/g,"¹");
html = html.replace(/º/g,"º");
html = html.replace(/»/g,"»");
html = html.replace(/¼/g,"¼");
html = html.replace(/½/g,"½");
html = html.replace(/¾/g,"¾");
html = html.replace(/¿/g,"¿");
html = html.replace(/×/g,"×");
html = html.replace(/÷/g,"÷");
html = html.replace(/À/g,"À");
html = html.replace(/Á/g,"Á");
html = html.replace(/Â/g,"Â");
html = html.replace(/Ã/g,"Ã");
html = html.replace(/Ä/g,"Ä");
html = html.replace(/Å/g,"Å");
html = html.replace(/Æ/g,"Æ");
html = html.replace(/Ç/g,"Ç");
html = html.replace(/È/g,"È");
html = html.replace(/É/g,"É");
html = html.replace(/Ê/g,"Ê");
html = html.replace(/Ë/g,"Ë");
html = html.replace(/Ì/g,"Ì");
html = html.replace(/Í/g,"Í");
html = html.replace(/Î/g,"Î");
html = html.replace(/Ï/g,"Ï");
html = html.replace(/Ð/g,"Ð");
html = html.replace(/Ñ/g,"Ñ");
html = html.replace(/Ò/g,"Ò");
html = html.replace(/Ó/g,"Ó");
html = html.replace(/Ô/g,"Ô");
html = html.replace(/Õ/g,"Õ");
html = html.replace(/Ö/g,"Ö");
html = html.replace(/Ø/g,"Ø");
html = html.replace(/Ù/g,"Ù");
html = html.replace(/Ú/g,"Ú");
html = html.replace(/Û/g,"Û");
html = html.replace(/Ü/g,"Ü");
html = html.replace(/Ý/g,"Ý");
html = html.replace(/Þ/g,"Þ");
html = html.replace(/ß/g,"ß");
html = html.replace(/à/g,"à");
html = html.replace(/á/g,"á");
html = html.replace(/â/g,"â");
html = html.replace(/ã/g,"ã");
html = html.replace(/ä/g,"ä");
html = html.replace(/å/g,"å");
html = html.replace(/æ/g,"æ");
html = html.replace(/ç/g,"ç");
html = html.replace(/è/g,"è");
html = html.replace(/é/g,"é");
html = html.replace(/ê/g,"ê");
html = html.replace(/ë/g,"ë");
html = html.replace(/ì/g,"ì");
html = html.replace(/í/g,"í");
html = html.replace(/î/g,"î");
html = html.replace(/ï/g,"ï");
html = html.replace(/ð/g,"ð");
html = html.replace(/ñ/g,"ñ");
html = html.replace(/ò/g,"ò");
html = html.replace(/ó/g,"ó");
html = html.replace(/ô/g,"ô");
html = html.replace(/õ/g,"õ");
html = html.replace(/ö/g,"ö");
html = html.replace(/ø/g,"ø");
html = html.replace(/ù/g,"ù");
html = html.replace(/ú/g,"ú");
html = html.replace(/û/g,"û");
html = html.replace(/ü/g,"ü");
html = html.replace(/ý/g,"ý");
html = html.replace(/þ/g,"þ");
html = html.replace(/ÿ/g,"ÿ");
html = html.replace(/“/g,"“");
html = html.replace(/”/g,"”");
html = html.replace(/Œ/g,"Œ");
html = html.replace(/œ/g,"œ");
html = html.replace(/Š/g,"Š");
html = html.replace(/š/g,"š");
html = html.replace(/Ÿ/g,"Ÿ");
html = html.replace(/ˆ/g,"ˆ");
html = html.replace(/˜/g,"˜");
html = html.replace(/–/g,"–");
html = html.replace(/—/g,"—");
html = html.replace(/‘/g,"‘");
html = html.replace(/’/g,"’");
html = html.replace(/‚/g,"‚");
html = html.replace(/“/g,"“");
html = html.replace(/”/g,"”");
html = html.replace(/„/g,"„");
html = html.replace(/†/g,"†");
html = html.replace(/‡/g,"‡");
html = html.replace(/…/g,"…");
html = html.replace(/‰/g,"‰");
html = html.replace(/‹/g,"‹");
html = html.replace(/›/g,"›");
html = html.replace(/€/g,"€");

return html;
}

[ add comment ] ( 22 views )   |  permalink  |   ( 3 / 368 )

| 1 | 2 | 3 | 4 | Next> Last>>


Home | Portfolio | Hosting | Web Development | Contact Us
© 2007 dpwebservices.net. All right reserved.