见如下代码:
<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里都能正常显示百度搜索框,这是为什么呢?
有没有朋友能解决这个问题?
<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里都能正常显示百度搜索框,这是为什么呢?
有没有朋友能解决这个问题?
<!--
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>
那应该就是跨越造成的,可能google有什么处理吧
访问百度能显示的,您可以弄个空白网页,然后把iframe代码加进去,可以的
<script type="text/javascript">
frames['ifrm'].location.href = "http://www.google.com.hk";
</script>
1.指定默认为空的页面时,才能正确使用文档内的属性
2.使用location.href
楼上的方法还是不可以,应该是google 有限制
<script type="text/javascript">
document.getElementById("ifrm").src ="http://www.baidu.com";
</script>
google有限止。。你无法在ie加载!(除了IETester ie6)百度可以打开