PageSourceSearch

http://jyclbj.cn/Message/js/Message.js

js jyclbj.cn collected 2026-10-07 13:14:21 UTC 6,608 bytes, 146 lines download raw bytes

1var nochar = "#999999";
2
3function sendMsg() {
4    document.getElementById("hide").style.display = "block";
5    var s_reg = /^([0-9]|[\-])+$/g;
6    var tel = document.getElementById("msgLeft_telephone").value;
7
8    if (document.getElementById("msgLeft_Txtbox").value == "在此留言,我们会及时联系您") {
9        alert("提醒:请输入留言内容!");
10        document.getElementById("hide").style.display = "none";
11        document.getElementById("msgLeft_Txtbox").focus();
12        return false;
13    }
14    if (document.getElementById("msgLeft_senderName").value == "请输入您的名称") {
15        alert("提醒:请输入您的姓名!");
16        document.getElementById("hide").style.display = "none";
17        document.getElementById("msgLeft_senderName").focus();
18        return false;
19    }
20    if (tel.match(s_reg) == null || tel.length < 7 || tel.length > 18 || document.getElementById("msgLeft_telephone").value == "请输入您的联系方式") {
21        alert("提醒:请输入正确的手机号码或电话号码\n\n例如:13916752109或023-86526333");
22        document.getElementById("hide").style.display = "none";
23        document.getElementById("msgLeft_telephone").focus();
24        return false;
25    }
26    if (document.getElementById("msgLeft_senderName").value.length >= 50) {
27        alert("提醒:留言人姓名过长");
28        document.getElementById("hide").style.display = "none";
29        document.getElementById("msgLeft_senderName").focus();
30        return false;
31    }
32
33    if (checkEmail(document.getElementById("msgLeft_email").value)) {
34        alert("提醒:邮箱格式不正确");
35        document.getElementById("hide").style.display = "none";
36        document.getElementById("msgLeft_email").focus();
37        return false;
38    }
39    /*
40    if(tel==""||document.getElementById("msgLeft_senderName").value==""||
41    document.getElementById("msgLeft_senderName").style.color==nochar||
42    document.getElementById("msgLeft_Txtbox").value==""||
43    document.getElementById("msgLeft_Txtbox").style.color==nochar||
44    document.getElementById("msgLeft_email").value==""||
45    document.getElementById("msgLeft_email").style.color==nochar)
46    {
47    alert("提醒:某个必填项为空");
48    document.getElementById("hide").style.zIndex = 1;
49    return false;
50    }
51    */
52    //有参数调用
53
54    $.ajax({
55        type: "POST",
56        url: "/message/Message.asmx/InMsg",
57        data: "{'name':'" + document.getElementById("msgLeft_senderName").value + "','phone':'" + document.getElementById("msgLeft_telephone").value + "','email':'" + document.getElementById("msgLeft_email").value + "','content':'" + document.getElementById("msgLeft_Txtbox").value + "','TName':'719172B65BAEA1F006'}",
58        contentType: "application/json; charset=utf-8",
59        dataType: 'json',
60        success: function (result) {
61            xmlResponse();
62        },
63        error: function (msg) {
64            alert("无法正常连接服务器,错误:\n"); //+req.statusText + ":" + req.status
65            document.getElementById("hide").style.zIndex = 1;
66            document.getElementById("msgLeft_Txtbox").value = "";
67            document.getElementById("msgLeft_senderName").value = "";
68            document.getElementById("msgLeft_telephone").value = "";
69            document.getElementById("msgLeft_email").value = "";
70            checkFocus();
71        }
72    });
73}
74
75function checkEmail(registeremail) {
76    //检验邮箱地址是否正确
77    var reg = /^[a-za-z0-9_-]+@[a-za-z0-9_-]+(\.[a-za-z0-9_-]+)+$/; //验证mail的正则表达式,^[a-za-z0-9_-]:开头必须为字母,下划线,数字,
78    if (!registeremail.match(reg) && registeremail != "") {
79        return true;
80    }
81    return false;
82
83}
84
85
86//电话号码验证
87String.prototype.Trim = function () {
88    var m = this.match(/^\s*(\S+(\s+\S+)*)\s*$/);
89    return (m == null) ? "" : m[1];
90}
91String.prototype.isMobile = function () {
92    return (/^(?:13\d|15[89])-?\d{5}(\d{3}|\*{3})$/.test(this.Trim()));
93}
94String.prototype.isTel = function () {
95    //"兼容格式: 国家代码(2到3位)-区号(2到3位)-电话号码(7到8位)-分机号(3位)"
96    //return (/^(([0\+]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/.test(this.Trim()));
97    return (/^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/.test(this.Trim()));
98}
99
100//最后修改页面
101function xmlResponse() {
102    document.getElementById("hide").style.zIndex = 1;
103    document.getElementById("msgLeft_Txtbox").value = "";
104    document.getElementById("msgLeft_senderName").value = "";
105    document.getElementById("msgLeft_telephone").value = "";
106    document.getElementById("msgLeft_email").value = "";
107    checkFocus();
108    alert("留言成功");
109	window.location.reload();
110}
111
112function checkFocus() {
113    if (document.getElementById("msgLeft_Txtbox").value == "" && document.activeElement.id != "msgLeft_Txtbox") {
114        document.getElementById("msgLeft_Txtbox").placeholder = "在此留言,我们会及时联系您";
115        document.getElementById("msgLeft_Txtbox").style.color = nochar;
116    }
117    if (document.getElementById("msgLeft_senderName").value == "" && document.activeElement.id != "msgLeft_senderName") {
118        document.getElementById("msgLeft_senderName").placeholder = "请输入您的名称";
119        document.getElementById("msgLeft_senderName").style.color = nochar;
120    }
121    if (document.getElementById("msgLeft_telephone").value == "" && document.activeElement.id != "msgLeft_telephone") {
122        document.getElementById("msgLeft_telephone").placeholder = "请输入您的联系方式";
123        document.getElementById("msgLeft_telephone").style.color = nochar;
124    }
125    if (document.getElementById("msgLeft_email").value == "" && document.activeElement.id != "msgLeft_email") {
126        document.getElementById("msgLeft_email").placeholder = "请输入您的邮箱";
127        document.getElementById("msgLeft_email").style.color = nochar;
128    }
129}
130function BeFocus(itemName) {
131    if (document.getElementById(itemName).style.color == nochar) {
132        document.getElementById(itemName).value = "";
133    }
134    document.getElementById(itemName).style.color = "black";
135}
136window.onload = function () {
137
138    document.getElementById("msgLeft_Txtbox").value = "";
139    document.getElementById("msgLeft_senderName").value = "";
140    document.getElementById("msgLeft_telephone").value = "";
141    document.getElementById("msgLeft_email").value = "";
142    checkFocus();
143}
144
145
146

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.