我想从我的iframe
里面设置div的高度。如何从iframe元素更改元素属性?
我有类似
<div id='test' style='height:150px;'>some stuff..</div>
<iframe id="test" src="http://www.myproject.com frameborder="0" scrolling="no">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test project</title>
<link rel="stylesheet" type="text/css" href="g_reset.css">
<script type="text/javascript" src="options.js"></script>
</head>
bunch of html...
<a id='click' href='#'>click<a/>
</iframe>
我希望能够改变“测试” DIV高度,当我点击“点击”我的iframe
内。
我options.js
我..
$('#click).click(function(){
alert('pop')
$('#test').attr('height','500');
})
警报会弹出,但它似乎并没有改变div
的高度。任何人都可以帮我解决这个问题吗?非常感谢!
iframe是否与实现iframe的主窗口相同的域/端口/协议加载? –
@StevenV是的。它在同一个域中。 – FlyingCat