搜索函数 function select() { var keyword = o('#edt-search').val(); var searchCount = 0; o('#tree-table').find('tbody tr td').each( function() { o(this).css('background-color', 'transparent'); var text = o(this).text(); if (keyword != '' && text.indexOf(keyword) >= 0) { o(this).css('background-color', 'rgba(250,230,160,0.5)'); if (searchCount == 0) { o("#scrolldiv").animate({ "scrollTop": o(this).offset().top - 50 }, 500); } searchCount++; } }); if (searchCount == 0) { layer.msg("无匹配", { icon: 4 }); } if (keyword == '') { layer.msg("请输入搜索内容", { icon: 5 }); } }