admin管理员组文章数量:1278979
I have homepage
containing middle_overlay div which is initially not visible .Also , it contains"iframe capture
" there is click button on page,on click event of button i want to make middle_overlay div visible, but from another page can i change how can i change css?
HTML:
<div id="middle_overlay">
</div>
<div id="middle">
<iframe id="middle_frame" src="capture.php" frameborder='0' border='0' style="border:0;" seamless>
</iframe>
</div>
JQuery ::
$(document).ready(function()
{
$('#Monthly_Report').click(function(){
alert('monthly report clicked');
$('#middle_overlay').css('display','block');
});
});
I have homepage
containing middle_overlay div which is initially not visible .Also , it contains"iframe capture
" there is click button on page,on click event of button i want to make middle_overlay div visible, but from another page can i change how can i change css?
HTML:
<div id="middle_overlay">
</div>
<div id="middle">
<iframe id="middle_frame" src="capture.php" frameborder='0' border='0' style="border:0;" seamless>
</iframe>
</div>
JQuery ::
$(document).ready(function()
{
$('#Monthly_Report').click(function(){
alert('monthly report clicked');
$('#middle_overlay').css('display','block');
});
});
Share
Improve this question
edited Oct 23, 2013 at 9:16
anam
asked Oct 23, 2013 at 9:12
anamanam
3,91316 gold badges46 silver badges85 bronze badges
3
- Please include attempted solutions, why they didn't work, and the expected results. – palaѕн Commented Oct 23, 2013 at 9:13
- @palasH have added js code please check – anam Commented Oct 23, 2013 at 9:17
- $('#Monthly_Report') is in iframe try alert $('#Monthly_Report').parents('iframe').attr('id'). If you can get that you can get to the parent. – Ali Exalter Commented Oct 23, 2013 at 9:19
3 Answers
Reset to default 9window.parent.$('#middle_overlay').css('display','block');
Note this will only work if your iframe and parent page are from the same domain.
You can try with this jquery solution also:
$("#middle_frame").contents().find('#Monthly_Report').click(function(e){
e.preventDefault();
$('#middle_overlay').show();
});
you have got your answer, but you can refer to this https://stackoverflow./a/19423398/1642219, to get more clear view of your problem
本文标签: javascriptfrom iframe page event change css of parentStack Overflow
版权声明:本文标题:javascript - from iframe page event change css of parent - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741248276a2365307.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论