alert(document.body.innerHTML);
只能显示body里的内容

解决方案 »

  1.   

    是这样的 :  我将一个文件读入 <iframe> , 然后想要逐行处理它 ;//--------------------------------------------------
    原始的需求是这样 , 我没有找到一个更好的办法处理 , 所以用了<iframe>  我们将一个网站的数据库转换为文件 , 然后想基于本地文件实现对数据的检索 , 也就是将对数据库的查询要转换为对本地文件的查询 , 我曾试图用 xml 实现 , 但没有完成 , 见 :  http://community.csdn.net/Expert/topic/3439/3439060.xml?temp=.3789484
      http://community.csdn.net/Expert/topic/3426/3426517.xml?temp=.2060968
      (都没能将多个查询条件传入xsl , 其中某些条件还要求模糊匹配)于是我只好借助 javascript 的 FSO , 但完成后总有 ActiveX 的安全警告 , 不是一个最终的解决办法 , 所以我又想利用 <iframe> 的 src 属性读入文件然后逐行遍历 , 满足条件的行再写入一个新的
    <iframe> 中 , 然后在页面的另外部分读取刚填充的这个 <iframe> , 完成检索内容的显示   我知道如上方式肯定是一个极苯极累的办法 ,也请大家就这个解决方案提点意见 ,谢谢
      

  2.   

    为什么要转换为对本地文件的查询,直接查数据库不行吗?
    FSO这样的东西不用为好
      

  3.   

    现在能想到的办法就是用fso的readline方法了~ReadLine 方法
    从TextStream 文件中读取一整行(一直到换行符,但不包括换行符),并返回由此得到的字符串。object.ReadLine( )object 参数总是 TextStream 对象的名称。 说明
    下面的示例演示了Line 属性的用法:function GetLine()
    {
       var fso, f, r;
       var ForReading = 1, ForWriting = 2;
       fso = new ActiveXObject("Scripting.FileSystemObject");
       f = fso.OpenTextFile("c:\\testfile.txt", ForWriting, true);
       f.WriteLine("Hello world!");
       f.WriteLine("JScript is fun");
       f.Close();
       f = fso.OpenTextFile("c:\\testfile.txt", ForReading);
       r =  f.ReadLine();
       return(r);
    }
      

  4.   

    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <script defer>
    var _count = 0
    getText = ""
    getText = lll.document.body.innerText
    getText = getText.split("\r\n")
    showText= ""
    function kkk(){
    clearTimeout(ooo) showText = showText + getText[_count] + "\n"
    _count++

    lll.document.body.innerText = showText
    if( _count == getText.length ){
    clearTimeout(ooo)
    _count = 0
    return

    }
    var ooo = setTimeout("kkk()",300)
    }
    kkk()
    </script>
    <body>
    <iframe src="file:///C|/temp/FileSystemObject/myjstest.txt" name="lll"></iframe>
    </body>
    </html>