当iframe没有ID时,向父级隐藏iframe中的元素 [英] hide elements in an iframe from the parent when the iframe has no id

查看:303
本文介绍了当iframe没有ID时,向父级隐藏iframe中的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

网址为 http://oxfordgenetics.com/plasmid-builder ,而iframe来自每个构建器组上的产品详细信息"链接.我需要做的是隐藏单击此链接时出现的阴影框中的某些元素.

The url is http://oxfordgenetics.com/plasmid-builder and the iframe comes from the "product details" link on each builder group. What I need to do is hide some of the elements in the shadowbox that appears when this link is clicked.

我尝试了所有常用的补救措施(jQuery和js)都没有成功,因为大多数补救措施都是使用此处不存在的ID锁定到iframe上的.

I have tried all of the usual remedies (both jQuery and js) without success as most of them latch onto the iframe using its ID which doesn't exist here.

当然是同一域.

推荐答案

我通过下面的代码来测试它是否为模态"框,而不是仅在模态"窗口中具有任意ID的方法来解决:

I got around it by having the code below test if it was a 'modal' box or not with an arbitrary ID that was only in the 'modal' window:

var element = document.getElementById('system-message-container'); 
if (typeof(element) != 'undefined' && element != null)
{
       document.getElementById('cartarea').style.display='none';
}

这篇关于当iframe没有ID时,向父级隐藏iframe中的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆