1function isBlank(s) 2{ 3 if ( (s == null) || (s.length == 0) ) 4 return true; 5 6 for(var i = 0; i < s.length; i++) 7 { 8 var c = s.charAt(i); 9 if ((c != ' ') && (c != '\n') && (c != '\t')) 10 return false; 11 } 12 return true; 13} 14 15function validate(frm) { 16 if (isBlank(frm.mail.value) || frm.mail.value.indexOf("@") == -1) { 17 frm.mail.focus(); 18 return false; 19 } 20 if (isBlank(frm.name.value)) { 21 frm.name.focus(); 22 return false; 23 } 24 25 if (isBlank(frm.text.value)) { 26 frm.text.focus(); 27 return false; 28 } 29}