$(function(){ //加载导航栏目信息 var checkId; $.ajax({ url : 'queryServiceCenterInfo', data:{ parentId:-1 }, type:'post', dataType:'json', cache:false, async: false, beforeSend: function(xhr) { $('.bl-hd ul').children().remove(); }, success:function(result){ var data = eval(result).serviceCenterList; if(null!=data && "" != data){ $.each(data, function(i, item) { var pid = item.id; var trObj; if(i==0){ trObj = $('
  • '); checkId = pid; }else{ trObj = $('
  • '); } if(pid != '-998'){ trObj.append(''+item.name+'') .appendTo($('.bl-hd ul')); }else{ //trObj.append(''+item.name+'') //.appendTo($('.bl-hd ul')); trObj.append(''+item.name+'') .appendTo($('.bl-hd ul')); } }); } } }); var paramObj = _parserUrl(window.location.href); var id = paramObj.id; if(id==0){ id=checkId; } var oneNode = $("#tab li"); oneNode.each(function(n){ $(this).removeClass("on"); }); var oneNode = $("#tab li[pid="+id+"]"); oneNode.addClass('on'); // 加载服务中心内容 $('.bl-hd .serviceContent').live('click', function() { var id = $(this).attr('id'); window.location.href = "queryserviceIndex?id=" + id; }); // 加载咨询答疑信息 $('.bl-hd .consultInfo').live('click', function() { var id = $(this).attr('id'); window.location.href = "queryConsultIndex?id="+id; }); //防止表单自动提交 $("#searchForm").submit(function(){ return false; }); //解除commons.js中的 on()方法绑定 $("input[name=serviceKey]").off(); // 搜索回车事件 $("input[name=serviceKey]").keydown(function(e){ if(e.keyCode == 13){ $('#submitSearchForm').click(); } }); //搜索 $('#submitSearchForm').click(function(){ var key = $.trim($('input[name="serviceKey"]').val()); var keyName = $.trim($('input[name="keyName"]').val()); if(key.length > 50){ key = key.substring(0,50); } oneNode.each(function(n){ $(this).removeClass("on"); }); //防止特殊字符查询给过滤,特此贴换 key=key.replace(/\%/g,"%25"); key=key.replace(/\#/g,"%23"); key=key.replace(/\&/g,"%26"); key=key.replace(/\+/g,"%2B"); //key=key.replace(/\//g,"%2F"); //key=key.replace(/\?/g,"%3F"); //key=key.replace(/\=/g,"%3D"); window.location.href = "toSearchView?keyWord="+key; }); });