日期:2014-05-16  浏览次数:20341 次

如何让iframe嵌入的页面在指定位置而不是默认的(0,0)?
<iframe id="tt" name="tt" src="http://www.baidu.com" width="400" height="160" frameborder="no" border="0" marginwidth="0" marginheight="140" scrolling="no">

以上代码如何控制baidu页面一开始出现的不是最左上的部分,而是中间文本框部分?

------解决方案--------------------
你可以这样
newWindow=document.getElementById("tt");
newWinddow.moveTo(50,50)
这个里面的数字你自己确定位置,根据你的页面调整里面的数字
------解决方案--------------------
利用 表格 定位
------解决方案--------------------
<iframe id="tt" name="tt" src="http://www.baidu.com" width="400" height="160" frameborder="no" border="0" marginwidth="0" marginheight="140" scrolling="no" onload="this.height = this.document.body.offsetHeight;this.width=this.document.body.offsetWidth;">
自适应高度的iframe,不知道是不是你想要的效果
------解决方案--------------------
用相对定位的层?
------解决方案--------------------
因为安全原因,moveTo()等函数不再被IE、Firfox支持了。