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 )
Validating numbers 
var digits="0123456789"
var temp


if (form.SSN3.value=="") {
alert("Please enter your Social Security Number.")
form.SSN3.focus();
return false;
}
for (var i=0;i<form.SSN3.value.length;i++){
temp=form.SSN3.value.substring(i,i+1)
if (digits.indexOf(temp)==-1){
alert("Only numbers are accepted in Social Security Number.")
form.SSN3.focus();
return false;
}
}


[ 1 comment ] ( 9 views )   |  permalink  |   ( 2.9 / 234 )
Disable print screen 
<html>
<head>
<script language="Javascript">
function setClipBoardData(){
setInterval("window.clipboardData.setData('text','')",20);
}
function blockError(){
window.location.reload(true);
return true;
}
window.onerror = blockError;
</script>

</head>

<body onload="setClipBoardData();">
</body>
</html>


[ add comment ] ( 8 views )   |  permalink  |   ( 3 / 237 )
Clear present browser history 
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>

<SCRIPT LANGUAGE="JavaScript">
function myhistory(url) {
if (document.images)
location.replace(url);
else
location.href = url;
}
</SCRIPT>
</head>

<body>

<a href="javascript:myhistory('test1.php')">Next Place</a>

</body>
</html>


[ add comment ] ( 5 views )   |  permalink  |   ( 2.8 / 176 )
Cross browser fix to open or close table rows, tables or DIVs 
 
function showHide(id) {
sel = document.getElementById(id);
if (sel.style.display == '') {
sel.style.display = 'none';
} else {
sel.style.display = '';
}
}
</script>

Instead of using "block" on <tr> and <table>, set the style back to NULL...


[ add comment ] ( 4 views )   |  permalink  |   ( 2.7 / 191 )

| 1 | 2 | 3 | 4 |


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