<input type=button value=得到这种效果就好了!!!><br>
<iframe id=iframe1 style="width:90%; height:50%" src="http://www.google.com"></iframe><br>
<textarea id=textarea1 style="width:90%; height:50%">
   所有网站   图像   网上论坛   网页目录   
 
   
  ? 高级搜索
 ? 使用偏好
 ? 语言工具 
搜索所有网站搜索所有中文网页搜索简体中文网页 
Google 大全 - Google.com in English 将 Google 设为首页!?2003 Google - 搜索 3,083,324,652 张网页
</textarea>

解决方案 »

  1.   

    <input type=button value="click" onclick="mysub()"><p>
    <iframe src="http://www.google.com" name="iframe1" id="iframe1">/iframe><p>
    <textarea name="tr1"></textarea>
    <textarea name="tr2"></textarea>
    <script language=vbs>
    sub mysub()
        tr1.innerText=iframe1.document.body.innerText
        tr1.innerText=iframe1.document.body.innerHTML
    end sub
    </script>
      

  2.   

    首先感谢楼上!Cooly(☆开心就好 ^o^ ☆) 不知道你试过没有,这段代码在IE6下报错
      

  3.   

    怎样得到iframe中的源文件,或文本?
    UP有分
      

  4.   

    <input type=button value='怎样得到iframe中的源文件,或文本?' onclick="s_ok()">
    <script>
    function s_ok()
    {
    textarea1.value=iframe1.document.all(0).outerHTML;
    textarea1.value=iframe1.document.all(0).outertext;
    }
    </script>
      

  5.   

    to: yzllfcn(星战) 
    试了一下不好用啊!
    不知道为什么?
      

  6.   

    textarea1.value=iframe1.document.documentElement.outerHTML;
      

  7.   

    <input type=button value=GO111 onclick=go1()>
    <input type=button value=GO222 onclick=go2()>
    <input type=button value=GO333 onclick=go3()>
    <br>
    <iframe id=iframe1 style="width:90%; height:50%" src="http://www.google.com">
    </iframe>
    <br>
    <textarea id=textarea1 style="width:90%; height:50%">
    大家帮我看看行:  14
    字符:3
    错误:拒绝访问。
    代码:0
    URL:...
    </textarea><script>
    function go1()
    {
      textarea1.value=iframe1.document.documentElement.outerHTML
    }
    function go2()
    {
      textarea1.value=iframe1.document.all(0).outerHTML
    }
    function go3()
    {
      textarea1.innerText=iframe1.document.body.innerText
    }
    </script>
      

  8.   

    textarea1.value=document.getElementById("iframe1").outerHTML
    //这样可以,但并不是我想要的!高人快来吧!!分不成问题300也可!!!
    //目的:怎样得到iframe中的源文件,或文本?急啊!
      

  9.   

    这个不是代码本身的问题。
    go1()和go2()的写法都是正确的。我看错误的原因主要是你没有适当的权限,www.google.com网拒绝你的访问。
    你不信换个本地链接试试,保证无误!!!
      

  10.   

    <input type=button value=GO111 onclick=go1()><br><iframe id=iframe1 style="width:90%;height:50%" src='C:\Documents and Settings\Administrator\桌面\a.html'></iframe><br><textarea id=textarea1 style="width:90%; height:50%">
    TO:yzllfcn(星战)你说的有道理,本地链接的确可以,但网上的都不行!目的:怎样得到iframe中的源文件,或文本?(iframe是网上的链接,比如www.google.com)还有没有别的办法啊!大侠救我!
    ***能否将IFRAME中的文本全选?然后复制到clipboard,再粘回textarea呢?</textarea>
    <script>
    function go1()
    {
      textarea1.value=iframe1.document.body.innerText
    }
    </script>
      

  11.   

    要想 "copy&paste" 另一域的 网页内容
    绝对是没门儿的。
    这是一个Hard code的设定,
    即使IE的安全级别设到最低(再+trusted site)
    也是不能容许的。
      

  12.   

    “能否将IFRAME中的文本全选?然后复制到clipboard,再粘回textarea呢”这是不可能的。安全设置是不充许的。要是能copy其它域的源代码,那别人辛苦编写的程序不是任人盗用了吗?
    你的意思我明白,不过要达到你要的效果,就等于入侵别人的机器,应该属于高级黑客的事了:)
      

  13.   

    function go2()
    {
      window.location='view-source:http://www.google.com';
    }
    显示到记事本。
    通过fso读取内容到textarea1.value,笨办法
      

  14.   

    这个方法也不行,显示到记事本的只是asp脚本在服务器端执行后发送到客户端的html语言。并不是真实的源码。
      

  15.   

    我只要“客户端的html”就好了,怎么做?大侠!
      

  16.   

    baisun(蟋蟀) 的方法倒是可行,可是还是不能直接写进textarea
    这个问题好像页没有什么好的办法了
      

  17.   

    <input type=button value=GO111 onclick=go1()><br>
    <input type=button value=CSDN onclick=csdn()><br>
    <input type=button value=SINA onclick=sina()><br><iframe id=iframe1 style="width:90%;height:50%" src="http://www.google.com"></iframe><br><textarea id=textarea1 style="width:90%; height:50%">
    试着做了一下,只能显示前33个字符。
    好像与文本的编码有关,请大家帮忙。
    谢谢!
    </textarea>
    <script>function loadContent(strURL)
    {
    var strContent = "";
    if (typeof strURL != "string" || strURL == "")return strContent;
    try
    {
    var oProxy = new ActiveXObject("Microsoft.XMLHTTP");

    oProxy["Open"]("GET", strURL, false);
    oProxy["Send"]();
    strContent = oProxy["responseText"];
    }
    catch(e){status = e.description}
    return strContent;
    }function go1()
    {
      var str
      str=loadContent(document.getElementById("iframe1").src)
      textarea1.value=str.substring(0,33)
    alert(document.getElementById("iframe1").src)
    }function csdn()
    {
      document.all.iframe1.outerHTML='<iframe id=iframe1 style="width:90%;height:50%" src="http://www.csdn.net"></iframe>'
    }
    function sina()
    {
      document.all.iframe1.outerHTML='<iframe id=iframe1 style="width:90%;height:50%" src="http://www.sina.com.cn"></iframe>'
    }
    </script>
      

  18.   

    <input value=提出代码已经实现!!!我的也OK了,谢谢大家! type=button onclick=go()><br>
    <iframe id=iframe1 style="width:90%; height:50%" src="http://www.google.com"></iframe><br>
    <textarea id=textarea1 style="width:90%; height:50%"></textarea>
    <script>function loadContent(strURL)
    {
    var strContent = "";
    if (typeof strURL != "string" || strURL == "")return strContent;
    try
    {
    var oProxy = new ActiveXObject("Microsoft.XMLHTTP");

    oProxy["Open"]("GET", strURL, false);
    oProxy["Send"]();
    strContent = oProxy["responseText"];
    }
    catch(e){status = e.description}
    return strContent;
    }function go()
    {
      textarea1.value=loadContent(document.getElementById("iframe1").src)
    }
    </script>