$(function () { $("input.ho").click(function (e) { var strphone, strcontent, strname, stremail, strcode,straddress,strcountry,strcity; strname = $("#name").val(); strphone = $("#phone").val(); strcontent = $("#message").val(); stremail = $("#stremail").val(); strcode = $("#postcode").val(); straddress = $("#address").val(); strcountry = $("#country").val(); strcity = $("#city").val(); if ($.trim(strname) == "") { jerror("please input your name", { horizontalposition: "center", verticalposition: "center", }); $("#name").focus(); return false; } if ($.trim(strcountry) == "") { jerror("please input country", { horizontalposition: "center", verticalposition: "center", }); $("#country").focus(); return false; } if ($.trim(strcity) == "") { jerror("please input city", { horizontalposition: "center", verticalposition: "center", }); $("#city").focus(); return false; } if ($.trim(straddress) == "") { jerror("please input your contact address", { horizontalposition: "center", verticalposition: "center", }); $("#address").focus(); return false; } if ($.trim(strcode) == "") { jerror("please input the zip code", { horizontalposition: "center", verticalposition: "center", }); $("#postcode").focus(); return false; } if ($.trim(stremail) == "") { jerror("please input the mailbox", { horizontalposition: "center", verticalposition: "center", }); $("#stremail").focus(); return false; } else { var re = /^[a-za-z\d]+([-_.][a-za-z\d]+)*@([a-za-z\d]+[-.])+[a-za-z\d]{2,4}$/; if (!re.test(stremail)) { jerror("error in mailbox format", { horizontalposition: "center", verticalposition: "center", }); $("#stremail").focus(); return false; } } if ($.trim(strphone) == "") { jerror("please input the contact number", { horizontalposition: "center", verticalposition: "center", }); $("#phone").focus(); return false; } else { var re = /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/; var re1 = /0\d{2}-\d{7,8}/; if (re.test(strphone) || re1.test(strphone)) { } else { jerror("wrong number format", { horizontalposition: "center", verticalposition: "center", }); $("#phone").focus(); return false; } } if ($.trim(strcontent) == "") { jerror("please input message", { horizontalposition: "center", verticalposition: "center", }); $("#message").focus(); return false; } zeng.msgbox.show("the data is submitted, please wait...", 6, 5001); try { $.ajax({ type: "post", async: false, url: "/en/ajaxdata.ashx", data: "action=addbook&name=" + escape(strname) + "&phone=" + escape(strphone) + "&content=" + escape(strcontent) + "&email=" +escape(stremail) + "&code=" + escape(strcode) + "&country=" + escape(strcountry) + "&address=" + escape(straddress) + "&city=" + escape(strcity) + "&lang=2", success: function (data) { var item = eval("(" + data + ")"); if (item.code == "200") { zeng.msgbox._hide(); zeng.msgbox.show("submit success", 4); } else { zeng.msgbox._hide(); jerror(item.msg, { horizontalposition: "center", verticalposition: "center", }); return false; } } }); } catch (ex) { zeng.msgbox._hide(); jerror(ex.message, { horizontalposition: "center", verticalposition: "center", }); } }); $("input#pingyiclick").click(function (e) { var strphone, strcontent, strname, strpingyi; strname = $("#name").val(); strphone = $("#mobile").val(); strcontent = $("#message").val(); strpingyi = $("#pingyi").val(); if ($.trim(strname) == "") { jerror("please input your name", { horizontalposition: "center", verticalposition: "center", }); $("#name").focus(); return false; } if ($.trim(strphone) == "") { jerror("please input the contact number", { horizontalposition: "center", verticalposition: "center", }); $("#mobile").focus(); return false; } else { var re = /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/; var re1 = /0\d{2}-\d{7,8}/; if (re.test(strphone) || re1.test(strphone)) { } else { jerror("wrong number format", { horizontalposition: "center", verticalposition: "center", }); $("#mobile").focus(); return false; } } if ($.trim(strpingyi) == "") { jerror("please input your opinion", { horizontalposition: "center", verticalposition: "center", }); $("#pingyi").focus(); return false; } if ($.trim(strcontent) == "") { jerror("please input suggestions", { horizontalposition: "center", verticalposition: "center", }); $("#message").focus(); return false; } zeng.msgbox.show("the data is submitted, please wait...", 6, 5001); try { $.ajax({ type: "post", async: false, url: "/en/ajaxdata.ashx", data: "action=addbook1&name=" + escape(strname) + "&phone=" + escape(strphone) + "&content=" + escape(strcontent) + "&pingyi=" + escape(strpingyi) + "&lang=2", success: function (data) { var item = eval("(" + data + ")"); if (item.code == "200") { zeng.msgbox._hide(); zeng.msgbox.show("submit success", 4); } else { zeng.msgbox._hide(); jerror(item.msg, { horizontalposition: "center", verticalposition: "center", }); return false; } } }); } catch (ex) { zeng.msgbox._hide(); jerror(ex.message, { horizontalposition: "center", verticalposition: "center", }); } }); })