社区
JavaScript
帖子详情
js操作iframe父窗口
怪才
2010-01-20 03:51:20
提个问题
<iframe src="test.html" id="test" width="100" height="100">
请问,是否可以在 test.html 中 使用js修改 这个id为test的height值?如何操作。
...全文
426
9
打赏
收藏
js操作iframe父窗口
提个问题 请问,是否可以在 test.html 中 使用js修改 这个id为test的height值?如何操作。
复制链接
扫一扫
分享
举报
写回复
配置赞助广告
用AI写文章
9 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
怪才
2010-01-20
打赏
举报
回复
[Quote=引用 8 楼 y_2716 的回复:]
引用 2 楼 cloudgamer 的回复:
window.parent.document.getElementById("test").style.height = xxx;
要parent属性干什么哦?
这个iframe不是本来就在这个窗口呢?
直接 document.getElementById("test").style.height = xxx;
不就可以了嘛?
[/Quote]
是子窗口调用父窗口。刚才测试的时候引号打错了。特此更正。
Y_2716
2010-01-20
打赏
举报
回复
[Quote=引用 2 楼 cloudgamer 的回复:]
window.parent.document.getElementById("test").style.height = xxx;
[/Quote]
要parent属性干什么哦?
这个iframe不是本来就在这个窗口呢?
直接 document.getElementById("test").style.height = xxx;
不就可以了嘛?
怪才
2010-01-20
打赏
举报
回复
#2楼(cloudgamer) 的理解是对的,但是代码无效,我现在就是这么写的。并且又重新写了一个测试,无效。无法改变height的值。
#3楼 (liubangls) 的知识获取,这个是正常的。
dpsing
2010-01-20
打赏
举报
回复
同域可以,不同域时不可以
parent.document.getElementById('test').style.height="2000px";
itliyi
2010-01-20
打赏
举报
回复
this.parent.bodyFrame.height 试试
nta5107179
2010-01-20
打赏
举报
回复
window.parent.document.getElementById("test").style.height="100px"
liubangls
2010-01-20
打赏
举报
回复
<script type='text/javascript'>
var test = parent.window.document.getElementById("test");
alert(test.id);
</script>
cloudgamer
2010-01-20
打赏
举报
回复
window.parent.document.getElementById("test").style.height = xxx;
changshoujun
2010-01-20
打赏
举报
回复
你想实现什么样的功能?
js
操作
iframe
和
父
窗口
工作中经常会用到,记录一下,免得总是到处找。 一、在
父
窗口
中获取
iframe
中的元素
JS
: 1.window.frames["
iframe
的name值"].document.getElementById("
iframe
中控件的ID") 2.var obj=document.getElementById("
iframe
的name").contentWindow; var ifmObj=obj.document.getElementById("
iframe
中控件的ID"); jquery: 1.$("
javascript
Iframe
(window.open()
操作
父
窗口
、子
窗口
)
JavaScript(
Iframe
、window.open)
父
窗口
与子
窗口
之间的
操作
by cubeking JavaScript(
Iframe
、window.open、window.showModalDialog)
父
窗口
与子
窗口
之间的
操作
一、
Iframe
篇 【通篇示例下载】 //
父
对象得到子
窗口
的值 //ObjectID是
窗口
标识,ContentID是元素ID funct...
JS
操作
iframe
里的dom
出自:http://www.css88.com/archives/2343 看到断桥残雪 对我上一篇日志的回复我也学习了一下
JS
操作
iframe
里的dom;主要参考了断桥残雪的《用JavaScript在IE和Firefox下进行
iframe
的DOM
操作
》和支付宝UED的《用
JS
访问
操作
iframe
里的dom 》,非常不错的两篇文章。 一、
父
级
窗口
操作
iframe
里...
JavaScript
iframe
操作
父
窗口
[code="java"] (function($){ $('a').each(function(i,o){ $(o).click(function(){ var link = $(o).attr('href'); //alert(link); ...
JS
操作
iframe
JS
获取
iframe
内的值 在
父
窗口
中获取
iframe
中的元素 格式:window.frames["
iframe
的name值"].document.getElementById("
iframe
中控件的ID").click(); 实例:window.frames["ifm"].document.getElementById("btnOk").click(); 格式: var...
JavaScript
87,984
社区成员
224,681
社区内容
发帖
与我相关
我的任务
JavaScript
Web 开发 JavaScript
复制链接
扫一扫
分享
社区描述
Web 开发 JavaScript
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章