/** * 通用模块 * */ function psearch() { var vsearchval = $.trim($("#txtsearch").val()); if (vsearchval == "") { $("#txtsearch").focus(); return false; } location.href = "product.php?url=products&keyword=" + escape(vsearchval); } function nsearch() { var vsearchval = $.trim($("#txtnewssearch").val()); if (vsearchval == "") { $("#txtnewssearch").focus(); return false; } location.href = "news.php?url=news&keyword=" + vsearchval; } //侧边栏在线客服 $(function() { // 悬浮窗口 $(".yb_conct").hover(function() { $(".yb_conct").css("right", "5px"); $(".yb_bar .yb_ercode").css('height', '200px'); }, function() { $(".yb_conct").css("right", "-157px"); $(".yb_bar .yb_ercode").css('height', '43px'); }); // 返回顶部 $(".yb_top").click(function() { $("html,body").animate({ 'scrolltop': '0px' }, 300) }); }); function fixjqtext(str) { var tempstr = str.replace(/\+/g, "+"); return tempstr; } $.fn.formreset = function () { $(this).each(function () { this.reset(); }); $("#msg").text(""); } $("#mc-submit").click(function () { var vemail = $.trim($("#femail").val()); if (vemail == "") { $("#femail").focus(); return false; } if (vemail != "") { var mail_filter = /^([a-za-z0-9_\.\-])+\@(([a-za-z0-9\-])+\.)+([a-za-z0-9]{2,4})+$/; if (!mail_filter.test(vemail)) { $("#femail").focus(); return false; } } $(this).attr("disabled", "disabled"); $("#fmsg").text("sending..."); var t = '客户留言'; $.ajax({ type: "post", url: "/order.php?action=add", data: { nickname: '游客', company: '', ptitle: t, phone: '', email: vemail, content: '', pageurl: document.url }, datatype: 'text', success: function (data) { if (data == 'ok') { alert('the message is successful, we will contact you as soon as possible!'); $("#fmsg").text(""); $("#footform")[0].reset(); } } }); return false; }); $("#imgsend").click(function () { var vrealname = $.trim($("#nickname").val()); if (vrealname == "") { $("#nickname").focus(); return false; } if (vrealname.length > 400) { $("#nickname").focus(); return false; } var vemail = $.trim($("#email").val()); if (vemail == "") { $("#email").focus(); return false; } if (vemail != "") { var mail_filter = /^([a-za-z0-9_\.\-])+\@(([a-za-z0-9\-])+\.)+([a-za-z0-9]{2,4})+$/; if (!mail_filter.test(vemail)) { $("#email").focus(); return false; } } var vsubmitphone = $.trim($("#phone").val()); var vcontent = $.trim($("#content").val()); if (vcontent == "") { $("#content").focus(); return false; } if (vcontent.length > 2000) { $("#content").focus(); return false; } $(this).attr("disabled", "disabled"); $("#msg").text("sending..."); var t = $.trim($("#ptitle").val()); var com = $.trim($("#company").val()); $.ajax({ type: "post", url: "/order.php?action=add", data: { nickname: vrealname, company: com, ptitle: t, phone: vsubmitphone, email: vemail, content: vcontent, pageurl: document.url }, datatype: 'text', success: function (data) { if (data == 'ok') { alert('send successfully, we will give you an answer within 24 hours !'); $("#msg").text(""); $("#commentform")[0].reset(); } } }); return false; });