我这里有张成绩表,excel的,直接粘贴到html的页面里了. 里面的内容是table,内容在一行一行的tr里面.
我找了一个搜索页面内容的js,但是现在想先把所有的内容隐藏掉,只显示搜索到的内容.不知道各位大侠有什么好推荐的思路.
excel不想入数据库. jquery试了,暂时没达到我想要的效果. 求助.

解决方案 »

  1.   

    <script language="JavaScript"> 
    <!-- 
    function doZoom(size){ 
    document.getElementById('zoom').style.fontSize=size+'px' 

    var DOM = (document.getElementById) ? 1 : 0; 
    var NS4 = (document.layers) ? 1 : 0; 
    var IE4 = 0; 
    if (document.all) 

    IE4 = 1; 
    DOM = 0; 

    var win = window; 
    var n = 0; 
    function findIt() { 
    if (document.getElementById("searchstr").value != "") 
    findInPage(document.getElementById("searchstr").value); 

    function findInPage(str) { 
    var txt, i, found; 
    if (str == "") 
    return false; 
    if (DOM) 

    win.find(str, false, true); 
    return true; 

    if (NS4) { 
    if (!win.find(str)) 
    while(win.find(str, false, true)) 
    n++; 
    else 
    n++; 
    if (n == 0) 
    alert("未找到指定内容."); 

    if (IE4) { 
    txt = win.document.body.createTextRange(); 
    for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) { 
    txt.moveStart("character", 1); 
    txt.moveEnd("textedit"); 

    if (found) { 
    txt.moveStart("character", -1); 
    txt.findText(str); 
    txt.select(); 
    txt.scrollIntoView(); 
    n++; 

    else { 
    if (n > 0) { 
    n = 0; 
    findInPage(str); 

    else 
    alert("未找到指定内容."); 


    return false; 
      

  2.   

    这个是搜索的 js. 
    内容类似
    <table>
    <tr>
    <td>
    张三:99分
    <td>
    </tr>
    </table>
    我把 tr 全部加了个class 内容是dispaly:none;求思路.
      

  3.   

    可以获取啊,用jQuery的  $('#hideId').text()
    或者document.getElementById('hideDiv').innerHTML
      

  4.   

    关键是我把所有内容全部隐藏了,而且tr没有唯一的id,我只想显示搜索张三时候,显示张三的成绩,其他的还是隐藏掉