我使用这个代码,得到的是空字符串
var dd=document.getElementById('myFame').innerText;
alert(dd);

解决方案 »

  1.   

    你要得到所有HTML代码?
    不跨域的话,直接用XMLHTTP去请求得到,跨域的话,就在服务端读取再返回给客户端。
      

  2.   

    如果别人的网站就先通过服务端XMLHTTP取数据。
      

  3.   

    document.getElementById('myFame').innerText;

    document.getElementById('myFame').value;
      

  4.   

    可以获取对iframe中的页面的引用,语法如下:window.frames['myFnme']但是,楼主在iframe中的是txt,javascript好像无法对其操作。
      

  5.   

    Iframe control --------------------------------------------------------------------------------I used the following code to load a different iframe depending on a users login. Something similar would work in your case.if($ValidUser == "Administrator"){
    //Load the administration modules into an iframe.
    echo"<iframe SRC=\"phpmyadmin/index.php\" width=\"100%\" height=\"100%\" frameborder=\"0\">If you can read this your browser does not support iframes.</iframe>";
    } else {
    //Load the standard module into the iframe.
    echo"<iframe SRC=\"TutIntro.php\" width=\"100%\" height=\"100%\" frameborder=\"0\">If you can read this your browser does not support iframes.</iframe>";
    }?>Hope this helps.
      

  6.   

    这样是不行的
    你可以在iframe里读取了那个txt文件 ,然后在传给父窗口。
      

  7.   

    上面说要取得数据
    下面又说要把
    <IFRAME id=myFame style="WIDTH: 573px; HEIGHT: 384px" marginWidth=0 marginHeight=0 
    src="http://www.sdfsdf.cn/yb.txt" 
    frameBorder=0 width=573 height=384></IFRAME>
    给一个变量,真郁闷
    想要咋样清楚点额
      

  8.   

    只能获取框架本身的数据,要想获得还得用HttpWebRequest