见如下代码:
<iframe name=ifrm id=ifrm frameSpacing=0 frameborder="NO" align="center" scrolling="no" width=600 height=600 ></iframe>
<script type="text/javascript">
frames['ifrm'].location = "http://www.google.com.hk";
</script>
以上代码在firefox,chrome里能正常显示谷歌搜索框,但是在ie里不能正常显示。
如果换成frames['ifrm'].location = "http://www.baidu.com";那么ie firefox chrome里都能正常显示百度搜索框,这是为什么呢?
有没有朋友能解决这个问题?
    

解决方案 »

  1.   

    判断浏览器类型:<script language="JavaScript"> 
        <!-- 
    function getOs() 

        var OsObject = ""; 
       if(navigator.userAgent.indexOf("MSIE")>0) { 
            return "MSIE"; 
       } 
       if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ 
            return "Firefox"; 
       } 
       if(isSafari=navigator.userAgent.indexOf("Safari")>0) { 
            return "Safari"; 
       }  
       if(isCamino=navigator.userAgent.indexOf("Camino")>0){ 
            return "Camino"; 
       } 
       if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){ 
            return "Gecko"; 
       } 
       

     alert("您的浏览器类型为:"+getOs()); 
        --> 
    </script> 
      

  2.   


    那应该就是跨越造成的,可能google有什么处理吧
      

  3.   

    <iframe name=ifrm id=ifrm frameSpacing=0 frameborder="NO" align="center" scrolling="no" width=600 height=600  src="http://www.google.com.hk"></iframe>IE 下这样都不能显示!
      

  4.   


    访问百度能显示的,您可以弄个空白网页,然后把iframe代码加进去,可以的
      

  5.   

    试了下,感觉是不是google有限制的呀,呵呵,我换成其它的网址,百度呀,新浪呀,,都能访问的咯
      

  6.   

    document.getElementById['ifrm'].src = "http://www.google.com.hk";
      

  7.   

    <iframe name=ifrm id=ifrm frameSpacing=0 src="about:blank" frameborder="NO" align="center" scrolling="no" width=600 height=600 ></iframe>
    <script type="text/javascript">
    frames['ifrm'].location.href = "http://www.google.com.hk";
    </script>
    1.指定默认为空的页面时,才能正确使用文档内的属性
    2.使用location.href
      

  8.   


    楼上的方法还是不可以,应该是google 有限制
      

  9.   

    <iframe name="ifrm" id="ifrm" frameSpacing="0" frameborder="0" align="center" scrolling="no" width="600" height="600" src="" ></iframe>
    <script type="text/javascript">
    document.getElementById("ifrm").src ="http://www.baidu.com";
    </script>
    google有限止。。你无法在ie加载!(除了IETester ie6)百度可以打开