1(function (window){ 2 /** 3 * è·åè¡¨åæ°æ® 4 */ 5 function getFormData(){ 6 var nameDom = document.getElementById("in-name") 7 var emailDom = document.getElementById("in-email") 8 var contentDom = document.getElementById("in-content") 9 return { 10 doms:{ 11 name: nameDom, 12 email: emailDom, 13 content: contentDom, 14 }, 15 values: { 16 name: nameDom.value, 17 email: emailDom.value, 18 content: contentDom.value 19 } 20 } 21 } 22 /** 23 * åé 24 */ 25 function send(){ 26 var formData = getFormData() 27 var values = formData.values 28 var doms = formData.doms 29 if(!values.email || !values.content){ 30 !values.email && doms.email.classList.add("input-error") 31 !values.content && doms.content.classList.add("input-error") 32 return 33 } 34 alert("表åå¼"+JSON.stringify(values)) 35 $.get("url", function (data,status){ 36 if(status === 0){ 37 // æå 38 doms.email.value = "" 39 doms.content.value = "" 40 doms.name.value = "" 41 } 42 }) 43 } 44 45 /** 46 * æ¸ é¤æ ¡éª 47 */ 48 function clearValidate(dom){ 49 // console.log("dom.value", dom.value) 50 if(dom.value){ 51 var hasErr = dom.classList.contains("input-error") 52 if(hasErr){ 53 dom.classList.remove("input-error") 54 } 55 } 56 } 57 /** 58 * é®ç®±å¤±å»ç¦ç¹ 59 */ 60 function emailBlur(){ 61 var emailDom = document.getElementById("in-email") 62 clearValidate(emailDom) 63 } 64 65 /** 66 * å 容失å»ç¦ç¹ 67 */ 68 function contentBlur(){ 69 var contentDom = document.getElementById("in-content") 70 clearValidate(contentDom) 71 } 72 /** 73 * æ´é²å ¨å±sendInquiry模ååæ¹æ³ 74 */ 75 window.sendInquiry = { 76 send, 77 emailBlur, 78 contentBlur 79 } 80})(window)
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.