1$(document).ready(function($) { 2 3 // hide messages 4 $(".error").hide(); 5 $(".success").hide(); 6 7 $('#contactForm input').click(function(e) { 8 $(".error").fadeOut(); 9 }); 10 11 // on submit... 12 $("#contactForm #submit").click(function() { 13 $(".error").hide(); 14 15 //required: 16 17 //name 18 var name = $("input#name").val(); 19 if(name == ""){ 20 //$("#error").fadeIn().text("Name required."); 21 $('#fname').fadeIn('slow'); 22 $("input#name").focus(); 23 return false; 24 } 25 26 //email (check if entered anything) 27 var email = $("input#email").val(); 28 //email (check if entered anything) 29 if(email == ""){ 30 //$("#error").fadeIn().text("Email required"); 31 $('#fmail').fadeIn('slow'); 32 $("input#email").focus(); 33 return false; 34 } 35 36 //email (check if email entered is valid) 37 38 if (email !== "") { // If something was entered 39 if (!isValidEmailAddress(email)) { 40 $('#fmail').fadeIn('slow'); //error message 41 $("input#email").focus(); //focus on email field 42 return false; 43 } 44 } 45 46function isValidEmailAddress(emailAddress) { 47 var pattern = new RegExp(/^(("[\w-+\s]+")|([\w-+]+(?:\.[\w-+]+)*)|("[\w-+\s]+")([\w-+]+(?:\.[\w-+]+)*))(@((?:[\w-+]+\.)*\w[\w-+]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][\d]\.|1[\d]{2}\.|[\d]{1,2}\.))((25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\.){2}(25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\]?$)/i); 48 return pattern.test(emailAddress); 49}; 50 51 52 53 54 // comments 55 var comments = $("#msg").val(); 56 57 if(comments == ""){ 58 //$("#error").fadeIn().text("Email required"); 59 $('#fmsg').fadeIn('slow'); 60 $("input#msg").focus(); 61 return false; 62 } 63 }); 64 65 66 // on success... 67 function success(){ 68 $("#success").fadeIn(); 69 $("#contactForm").fadeOut(); 70 } 71 72 return false; 73}); 74
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.