/* * to change this license header, choose license headers in project properties. * to change this template file, choose tools | templates * and open the template in the editor. */ $(function() { //var b = $('.header .frame .box'); //b.find('.nav').mouseenter(function() { $(this).css('height', 'auto'); b.stop().animate({ height: '230px' }, 'fast'); }); //b.mouseleave(function() { b.stop().animate({ height: '50px' }, 'fast', function() { b.find('.nav').css('height', '30px'); }); }); var b = $('.header .frame .box .nav .cha'); b.find('div').mouseenter(function(){changebackground($(this), 1)}); b.find('div').mouseleave(function(){changebackground($(this), 2);setdefaultcss(b);}); $('.adplay').each(adslide); adscroll(); searchinput(); //站内搜索 resizebanner(); $(window).resize(resizebanner); $('#weixin').bind('mouseenter', function(){myshow(1);}); $('#weixin').bind('mouseleave', function(){myshow(0);}); setdefaultcss(b); //服务与技术支持页面上的大图超过1024px宽度后两边是平铺处理的(其它模块是一个宽1920的图片),需要做一些特殊处理 if($('.content_page').width()>0){ if($('.content_page').prev().height()==0){ $('.content_page').addclass('content_page_old'); } } }); //设置导航栏默认样式 function setdefaultcss(b){ if($('.banner_font').text()){ b.find('div').each(function(){ if($('.banner_font').text() == $(this).html()){ if($(this).width()>125){ $(this).addclass('bg2'); }else{ $(this).addclass('bg1'); } } }); } } //鼠标悬浮在导航栏上时的样式 function changebackground(obj, type){ //type==1给选中的对象增加样式、type==0给选中的对象移除样式 $(obj).parent().siblings().find('div').each(function(i){ if($(this).width()>125){ $(this).removeclass('bg2'); }else{ $(this).removeclass('bg1'); } }); if(type==1){ if($(obj).width()>125){ $(obj).addclass('bg2'); }else{ $(obj).addclass('bg1'); } }else{ if($(obj).width()>125){ $(obj).removeclass('bg2'); }else{ $(obj).removeclass('bg1'); } } } //站内搜索 function searchinput(){ $("#sousuo").bind("click",clicksousuo); $(".searchinput").bind({focus:function(){ if(this.value=='请输入关键词'){ this.value=""; } },blur:function(){if(this.value==''){ this.value='请输入关键词'; }}}); } function clicksousuo(){ if(event.keycode!=13&&event.keycode!=0) return; $("#searchform").submit(); } function adscroll() { setinterval(function() { var h = $('.adscroll').height(); $('.adscroll').find("span:first").animate({ margintop: '-' + h + 'px' }, 500, function() { $(this).css('margin-top', '0').find('span:first').appendto(this); }); }, 3000); } function adslide() { var t; var n = 0; var p = $(this); var count = p.find('.list a').size(); p.find('.list a:not(:first-child)').hide(); p.find('.info').html(p.find('.list a:first-child').find('img').attr('alt')); p.find('.btn li:first-child'); p.find('.info').click(function() { window.open(p.find('.list a:first-child').attr('href'), '_blank') }); p.find('.btn li').click(function() { var i = $(this).attr('idx') - 1; n = i; if (i >= count) return; p.find('.info').html(p.find('.list a').eq(i).find('img').attr('alt')); p.find('.info').unbind().click(function() { window.open(p.find('.list a').eq(i).attr('href'), '_blank') }) p.find('.list a').filter(':visible').fadeout(500).parent().children().eq(i).fadein(1000); }); t = setinterval(function() { n = n >= (count - 1) ? 0 : n + 1; p.find('.btn li').eq(n).trigger('click'); }, 5000); p.hover(function() { clearinterval(t) }, function() { t = setinterval(function() { n = n >= (count - 1) ? 0 : n + 1; p.find('.btn li').eq(n).trigger('click'); }, 5000); }); } function callmenu(el){ if(!(el.classname.indexof("menu_title_close")>-1||el.classname.indexof("menu_title_open")>-1)&& el.parentnode&&el.parentnode.classname.indexof("treenode")>-1 ){return} var child,menutitle=el,treenode=el.parentnode; for(var i=0; i < treenode.childnodes.length; i++) { child = treenode.childnodes[i]; if(child.nodename!='div'){continue} if(child.classname.indexof("treesubnodeshidden")>-1){ child.classname =child.classname.replace("treesubnodeshidden","treesubnodes"); menutitle.classname="menu_title_open" break; }else if (child.classname.indexof("treesubnodes")>-1){ child.classname =child.classname.replace("treesubnodes","treesubnodeshidden"); menutitle.classname="menu_title_close" break; } } } function isemail(str){ var reg = /^([a-za-z0-9_-])+@([a-za-z0-9_-])+((\.[a-za-z0-9_-]{2,3}){1,2})$/; return reg.test(str); } function isnull(str){ return $.trim(str).length==0; } function isdate(str){ var reg = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/; if(!reg.test(str)){ return false; } var arr = str.split("-"); if(number(arr[0]) < 1950){ return false; } if(number(arr[1]) <= 0 || number(arr[1]) > 12){ return false; } if(number(arr[2]) <= 0 || number(arr[2]) > 31){ return false; } return true; } function ismobelphone(str){ var reg = /^1[1-9][0-9]{9}$/; return reg.test(str); } /** * 验证简历提交的正确性 */ function aboutjudgepost(){ /*验证名字*/ if(isnull($("#resumename").val())){ $("#resumename").after("名字不能为空"); $("#resumename")[0].focus(); $("#resumename")[0].select(); return false; } /*验证日期*/ if(!isdate($("#resumebirthday").val())){ $("#resumebirthday").after("日期格式有误(例:yyyy-mm-dd)"); $("#resumebirthday")[0].focus(); $("#resumebirthday")[0].select(); return false; } /*验证电话*/ if(!ismobelphone($("#resumephone").val())){ $("#resumephone").after("请正确填写手机号码"); $("#resumephone")[0].focus(); $("#resumephone")[0].select(); return false; } /*验证电子邮件*/ if(!isnull($("#resumeemail").val())){ if(!isemail($("#resumeemail").val())){ $("#resumeemail").after("email格式有误(例:abc@zcsoft.com)"); $("#resumeemail")[0].focus(); $("#resumeemail")[0].select(); return false; } } /*验证自我评价*/ if(isnull($("#resumeresumedescription").val())){ $("#resumeresumedescription").after("自我评价不能为空"); $("#resumeresumedescription")[0].focus(); $("#resumeresumedescription")[0].select(); return false; } if($.trim($("#resumeresumedescription").val()).length > 200){ $("#resumeresumedescription").after("不能超过200字"); $("#resumeresumedescription")[0].focus(); $("#resumeresumedescription")[0].select(); return false; } /*验证教育经历*/ if(isnull($("#resumeeducationdescription").val())){ $("#resumeeducationdescription").after("教育经历不能为空"); $("#resumeeducationdescription")[0].focus(); $("#resumeeducationdescription")[0].select(); return false; } if($.trim($("#resumeeducationdescription").val()).length > 500){ $("#resumeeducationdescription").after("不能超过500字"); $("#resumeeducationdescription")[0].focus(); $("#resumeeducationdescription")[0].select(); return false; } /*验证工作描述*/ if($.trim($("#resumeworkdescription").val()).length > 500){ $("#resumeworkdescription").after("不能超过500字"); $("#resumeworkdescription")[0].focus(); $("#resumeworkdescription")[0].select(); return false; } return true; } /**投递简历*/ function aboutpostpostinfo(){ //清空提示信息 $("span").remove(".txjl_err"); //验证提交表单的数据 if(!aboutjudgepost()){ return; } //提交数据 $.ajax({ cache : true, type : "post", url : $("#aboutpostinfoform")[0].action, data : $('#aboutpostinfoform').serialize(), async : false, error : function(request) { alert("connection error"); }, success : function(data){ alert(data.message); if(data.state=="0"){ return; } $("#btnaboutpostinforeset").click(); } }); } /**显示微信二维码*/ function myshow(a) { if(a==1){ document.getelementbyid('pic_weixin').style.display="block"; }else{ document.getelementbyid('pic_weixin').style.display="none"; } } function resizebanner(){ var scrollwidth = $('body').get(0).scrollwidth; if(scrollwidth<=1400){ $('#banner1').css('width', '100%'); $('#banner1_left').css('width', '0'); $('#banner1_right').css('width', '0'); $('#banner2').css('width', '100%'); $('#banner2_left').css('width', '0'); $('#banner2_right').css('width', '0'); $('#banner3').css('width', '100%'); $('#banner3_left').css('width', '0'); $('#banner3_right').css('width', '0'); }else{ $('#banner1').css('width', 1400); $('#banner1_left').css('width', (scrollwidth-1400)/2); $('#banner1_right').css('width', (scrollwidth-1400)/2); $('#banner2').css('width', 1400); $('#banner2_left').css('width', (scrollwidth-1400)/2); $('#banner2_right').css('width', (scrollwidth-1400)/2); $('#banner3').css('width', 1400); $('#banner3_left').css('width', (scrollwidth-1400)/2); $('#banner3_right').css('width', (scrollwidth-1400)/2); } }