PageSourceSearch

https://www.opldisplaytec.com/templates/tradeSite/assets/js/send-inquiry.js

js opldisplaytec.com collected 2026-10-08 01:28:43 UTC 1,757 bytes, 80 lines download raw bytes

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.