iframe 子页面改变父页面样式


iframe

子窗口调节父窗口样式:

$(window.parent.document).find("body").attr("style","background-color:#99FF00")

父元素改子元素样式(不跨域):

document.getElementById('iframeID').contentWindow.document.body.style.backgroundColor="#f00";

例如:

var topWindow=$(window.parent.document);

var iframe_box=topWindow.find("#iframe_box");//获取Iframe
iframe_box.find(".show_iframe").hide()

从多个iframe中查找元素

var topWindow = $(window.parent.document);
var $iframe = topWindow.find('#moreQuotes .moreStock_iframe');         
$iframe.contents().find('input.sunPageSearch').siblings('ul').css('display', 'none');

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM