脚本是不可以跨域操作的, 即你调用远程的页面时JS没有办法访问 iframe 里加载的页面.

解决方案 »

  1.   

    http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=204846
      

  2.   

    function  iframeAutoFit()  
       {  
           if(self!=top  &&  window.name=="Owner")  
           {  
               var  iframe  =  parent.document.getElementById(window.name);  
               if(iframe)  
               {  
                   iframe.parentNode.style.height  =  iframe.style.height;  
                   iframe.style.height  =  10;  
                   var  h  =  document.body.scrollHeight;  
                   var  minimalHeight  =  parseInt((window.screen.width*11)/16,  10)  -  280;  
                   h  =  h<minimalHeight  ?  minimalHeight  :  h;  
                   if(window.navigator.appName  ==  "Microsoft  Internet  Explorer"  
                       &&  iframe.frameBorder=="1")  h  +=  4;  
                   iframe.parentNode.style.height  =  iframe.style.height  =  h;  
               }  
               else  alert("Iframe's  id  unequal  to  iframe's  name!");  
           }  
       }  
       if(document.attachEvent)  window.attachEvent("onload",  iframeAutoFit);  
       else  window.addEventListener('load',  iframeAutoFit,  false);  
    中window.screen.width*11)/16是什么意思?取什么值?
      

  3.   

    window.screen.width*11)/16是什么意思?取什么值?
      

  4.   

    以下是a.html的内容<iframe src="http://www.b.com/b.htm" >      
    </iframe>   www.b.com/b.htm:
    <body onload="window.resizeTo(document.body.scrollWidth+10,document.body.scrollHeight+10);">
    fdsafdsafd
    </body>
      

  5.   

    跨域的frame你是没有权限调整大小的。解决方法除非你在自己的域下写一个动态脚本文件,然后动态抓取远程的这个文件。