码迷,mamicode.com
首页 > 其他好文 > 详细

iframe 子页面改变父页面样式

时间:2017-09-16 16:08:02      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:div   res   tab   logs   get   ntb   nbsp   content   样式   

iframe

子窗口调节父窗口样式:

$(window.parent.document).find("body").attr("style","

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

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‘);

 

iframe 子页面改变父页面样式

标签:div   res   tab   logs   get   ntb   nbsp   content   样式   

原文地址:http://www.cnblogs.com/SPHmomo/p/7531317.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!