首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

怎么让iframe嵌入的页面在指定位置而不是默认的(0,0)

2012-04-18 
如何让iframe嵌入的页面在指定位置而不是默认的(0,0)?iframe idtt namett srchttp://www.baidu.c

如何让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支持了。

热点排行