大家好,帮忙看下这个代码,在IE里面能正常调取src的内容到网页显示,但在火狐里提示"document.all is not a function",并且不能正常显示出来,各位大神,教我。谢谢!document.writeln("<BODY align=center>");
document.writeln("<table width=\"1002\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
document.writeln("<tr>");
document.writeln("<td><iframe name=\"Showme\" src=\"/game.asp\" width=1002 height=2500 scrolling=no onload=document.all('Showme').height=Showme.document.body.scrollHeight+0 border=\"0\" frameborder=\"0\" ></iframe><\/td>");
document.writeln("<\/tr>");
document.writeln("<\/table>");
document.writeln("<\/BODY>");

解决方案 »

  1.   

    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="gb2312" />
    <title></title>
    </head>
    <body>
    <script>
    document.writeln("<BODY align=center>");
    document.writeln("<table width=\"1002\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
    document.writeln("<tr>");
    document.writeln("<td><iframe name=\"Showme\" src=\"http://www.baidu.com/\" width=1002 height=2500 scrolling=no onload=document.all('Showme').height=Showme.document.body.scrollHeight+0 border=\"0\" frameborder=\"0\" ></iframe><\/td>");
    document.writeln("<\/tr>");
    document.writeln("<\/table>");
    document.writeln("<\/BODY>");
    </script>
    </body>
    </html>没问题啊。
      

  2.   

    最好使用DOM标准来获取节点
    给iframe弄个id值 ,然后
    document.getElementById('Showme')
      

  3.   

    document.all貌似只有ie支持  火狐的话说是不支持  但实际上也支持 但他的兼容性目前还不是特别的好 所以最好还是用document.getElementById吧
      

  4.   

    在IE使用是没问题啊,在FF不行,提示"document.all is not a function"错误,貌似FF不能用"document.all",本人对JS也不熟,有哪位朋友能把实现上面功能的代码发出来吗,要兼容IE及FF啊,感激不尽。
      

  5.   


    <!DOCTYPE HTML>
    <html>
        <head>
            <meta charset="gb2312" />
            <title></title>        
        </head>
        <body>
    <script>
    document.writeln("<BODY align=center>");
    document.writeln("<table width=\"1002\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
    document.writeln("<tr>");
    document.writeln("<td><iframe name=\"Showme\" id=\"Showme\" src=\"http://www.baidu.com/\" width=1002 height=2500 scrolling=no onload=document.getElementById('Showme').height=Showme.document.body.scrollHeight+0 border=\"0\" frameborder=\"0\" ></iframe><\/td>");
    document.writeln("<\/tr>");
    document.writeln("<\/table>");
    document.writeln("<\/BODY>");
            </script>
        </body>
    </html>改下 getElementById 就可以了。
    楼主要 iframe自适应高度的话,搜下吧,很多相关信息的。
      

  6.   

    感谢calmcrime朋友,也谢谢其它朋友的解答,现在FF和IE都OK了,但GOOGLE还是不行,高度不能完全适应我的文件,要怎么修改呢
      

  7.   

    楼主 是不是在本地测试的chrome 自适应高度 需要 以http这样的方式来测试。