锘縡unction layeralert(title, text) { layui.use('layer', function () { var layer = layui.layer; layer.open({ title: title, content: text, btn: ['OK'] }) }) } function layeralert2(title, text, url) { layui.use('layer', function () { var layer = layui.layer; layer.open({ title: title, content: text, btn: ['OK'], yes: function () { linkto(url); } }) }) } function linkto(url) { location.href = url; } var emailRule = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; var phoneRule = /^(13|14|15|16|17|18|19)[0-9]{9}$/; var telRule = /^0\d{2,3}-?\d{7,8}$/; var passRule = /^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)])+$).{8,16}$/; function search1() { if (document.getElementById("txtkeys1").value == "") { layeralert("Message", "Please input keywords"); } else { location.href = "/en/search.aspx?k=" + document.getElementById("txtkeys1").value; } } function search2() { if (document.getElementById("txtkeys2").value == "") { layeralert("Message", "Please input keywords"); } else { location.href = "/en/search.aspx?k=" + document.getElementById("txtkeys2").value; } } $('.nav-main .main-box .box-nav .nav-item .item-subnav2 .subnav-list .list-lump').hover(function () { $('.nav-main .main-box .box-nav .nav-item .item-subnav2 .subnav-list .list-lump').removeClass('list-lump-active').eq($(this).index()).addClass('list-lump-active') $('.nav-main .main-box .box-nav .nav-item .item-subnav2 .subnav-cent').removeClass('subnav-cent-active').eq($(this).index()).addClass('subnav-cent-active') }) $(function () { if($('.head-banner2').length>0){ let headBanner = new Swiper('.head-banner2', { direction: 'horizontal', effect : 'fade', speed: 800, loop: true, loopAdditionalSlides: 0, autoplay: true, autoplay: { disableOnInteraction: false, delay: 5000, }, pagination: { el: '.head-banner2 .swiper-pagination', clickable :true, }, navigation: { nextEl: '.banner-swiper-button-next', prevEl: '.banner-swiper-button-prev', }, }); } $(".newsDetail .newsDetail-main .main-cent .cent-box").find('img').css({ "max-width": "100%", "height": "auto" }); $(".newsDetail .newsDetail-main .main-cent .cent-box").find('input[type=image]').css({ "max-width": "100%", "height": "auto" }); $(".product-main .main-cont").find('img').css({ "max-width": "100%", "height": "auto" }); $(".product-main .main-cont").find('input[type=image]').css({ "max-width": "100%", "height": "auto" }); if ($(window).width() < 1004) { $('header .head-banner .banner-cent').find('*').each(function (i, e) { if ($(e).attr('style') != undefined && $(e).attr('style').indexOf('font-size') != -1) { var fontSize = $(e).css('font-size') if (fontSize.indexOf('px') != -1) { $(e).css('font-size', (parseFloat(fontSize) - 20) + 'px') } } }) $('header .head-banner2 .swiper-slide .slide-box .box-cent').find('*').each(function (i, e) { if ($(e).attr('style') != undefined && $(e).attr('style').indexOf('font-size') != -1) { var fontSize = $(e).css('font-size') if (fontSize.indexOf('px') != -1) { $(e).css('font-size', (parseFloat(fontSize) - 20) + 'px') } } }) } $("#txtkeys1").keydown(function (e) { if (e.keyCode == 13) { search1(); } }); $("#txtkeys2").keydown(function (e) { if (e.keyCode == 13) { search2(); } }); }) function addmessage(type) { console.log($("#item1").prop('checked')) var firstname = $("#firstname").val(); var lastname = $("#lastname").val(); var title = $("#title").val(); var email = $("#email").val(); var company = $("#company").val(); var country = $("#country").val(); var tel = $("#tel").val(); var content = $("#content").val(); var subscribe = 0; if ($("#item1").prop('checked')) subscribe = 1; if (firstname == "") { layeralert("Message", "Please enter your First name!"); return } if (lastname == "") { layeralert("Message", "Please enter your Last name!"); return } //if (tel == "") { // layeralert("Message", "璇峰~鍐欐偍鐨勭數璇濆彿鐮?"); // return //} //if (!telRule.test(tel) && !phoneRule.test(tel)) { // layeralert('Message', '璇疯緭鍏ユ纭牸寮忕數璇濆彿鐮侊紒'); // return false; //} if (email == "") { layeralert("Message", "Please enter your E-mail!"); return } if (!emailRule.test(email)) { layeralert('Message', 'Please enter the correct format e-mail!'); return false; } if (company == "") { layeralert("Message", "Please enter your Company / Institute!"); return } if (country == "") { layeralert("Message", "Please enter your Country!"); return } if (content == "") { layeralert("Message", "Please kindly leave your comments!"); return } $.ajax({ type: "post", url: "/AjaxAction/message.ashx?action=addmessage&randroom=" + Math.random(), dataType: "JSON", data: { "firstname": firstname, "lastname": lastname, "title": title, "email": email, "company": company, "country": country, "tel": tel, "content": content, "subscribe": subscribe, "m": type }, success: function (data) { if (data.status == 1) { layeralert2("Message", "Thank you for your message.", window.location.href); } else { layeralert("Message", data.msg); } } }); }