a.html 中有个<iframe src='b.html' name="myframe"></iframe>
var tmp="<html>"+myframe.document.getElementsByTagName("HTML").item(0).innerHTML+"<html>";tmp即为iframe的所有源码。
然后再考虑copy系统剪贴板中。//没有使用过系统的这些东西,估计是使用控件之类

解决方案 »

  1.   

    楼上的~~
    myframe.document等同于document
    也就是取到了元素所在的document对象~~而不是元素的document对象~~~
      

  2.   

    <iframe src="1.htm" id="iframes" marginWidth="10" marginHeight=10 frameborder="0" width="100%" height="100%" scrolling="no"></iframe>
    <input type="button" value="复制iframe中页面的源码到剪切板" onclick="copyviewsource()">
    <script>
    function copyviewsource(){
      var tmp="<HTML>"+window.frames['iframes'].document.getElementsByTagName('HTML')[0].innerHTML+"</HTML>";
      alert(tmp);
      window.clipboardData.setData('text', tmp);
    }
    </script>
    引用iframe中嵌入页面的相关属性,使用window.frames['iframeid']
    引用iframe的相关属性,使用document.getElementById('iframeid')
      

  3.   

    无稽之谈框架内桢的document对象这样获取
    document.getElementById("iframeid").contentWindow.document