/*! * superslide v2.1.1 * 轻松解决网站大部分特效展示问题 * 详尽信息请看官网:http://www.superslide2.com/ * * copyright 2011-2013, 大话主席 * * 请尊重原创,保留头部版权 * 在保留版权的前提下可应用于个人或商业用途 * v2.1.1:修复当调用多个superslide,并设置returndefault:true 时返回defaultindex索引错误 */ //--------------------------------导航 js-------------------------------------// function dropmenu(obj){ $(obj).each(function(){ var thespan = $(this); var themenu = thespan.find(".submenu"); var tarheight = themenu.height(); themenu.css({height:0,opacity:0}); var t1; function expand() { cleartimeout(t1); thespan.find('a').addclass("selected"); themenu.stop().show().animate({height:tarheight,opacity:1},200); } function collapse() { cleartimeout(t1); t1 = settimeout(function(){ thespan.find('a').removeclass("selected"); themenu.stop().animate({height:0,opacity:0},200,function(){ $(this).css({display:"block"}); }); }, 250); } thespan.hover(expand, collapse); themenu.hover(expand, collapse); }); } $(document).ready(function(){ dropmenu(".nav_li"); }); //提交 $(function () { $('.submit-btn').on('click', function () { var kcontent = $('.xqcontent').val(); //内容 var kuser = $('.username').val(); //名字 var kphone = $('.usertel').val(); //电话 var kcode = $('.codetext').val().trim();//验证码的input // var kemail = $('.useremail').val(); var reg = /(^(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$)|(^((\(\d{3}\))|(\d{3}\-))?(1[3578]\d{9})$)|(^400[0-9]{7})/; if (kuser == "") { alert('姓名不能为空!') $(".username").focus(); return false; } if (kphone == "") { alert('号码不能为空!') $(".usertel").focus(); return false; } if(!reg.test(kphone)) { alert('号码填写有误!') $(".usertel").focus(); return false; } if (kcontent == "" || kcontent.length < 10) { alert('留言内容必须大于10字!') $(".xqcontent").focus(); return false; } if (kcode == "") { //验证码的input alert('验证码不能为空') $(".codetext").focus(); return false; } $.post('/api/message.ashx?action=add', { "kcontent": '信息:' + kcontent , "kuser": kuser, "kphone": kphone, "kcode": kcode //验证码的程序调用 }, function (res) { if (res == 1) { alert("留言提交成功"); $('.xqcontent').val(''); $('.username').val(''); $('.usertel').val(''); $('.codetext').val(''); }else { alert("留言提交失败") } }) }) }) $('.submit-qc').on('click', function () { $('.xqcontent').val(''); $('.username').val(''); $('.usertel').val(''); $('.codetext').val('');//验证码的input }); //验证码刷新 $(".imgcode").click(function () { //验证码图片刷新 $(this)[0].src = '/api/message.ashx?action=code&' + math.random() }); //新闻滚动// $(function () { $(".wel_con").slide({maincell: ".tel_news ul", effect: "toploop", autoplay: true, vis: 1, scroll: 1, delaytime:500, }); }); // 搜索 $('.searchico .hide').click(function(){ $(".searchbox").removeclass("searchshow"); $(".searchico").removeclass("top"); }); $('.searchico .show').click(function(){ $(".searchbox").addclass("searchshow"); $(".searchico").addclass("top"); }); $('.searchico .hide').click(function(){ $(".searchbox").removeclass("searchshow"); $(".searchico").removeclass("top"); });