改变iframe Z-指数

时间:2014-12-22 04:23:24

标签: javascript jquery html z-index

如何更改iframe的z-index。我的页面生成一个随机id的iframe,我能够读取iframe ID,但不知道如何更改iframe的z-index,现在设置为10000,我想将其更改为-1。这是我的iframe。

<iframe marginheight="0px" marginwidth="0px" frameborder="0" scrolling="no" id="ebBannerIFrame_24907031_5179572172928602" src="http://ds.serving-sys.com/BurstingRes//Site-2/WSFolders/3006392_201//index.html?v=_2_27_1_0" allowtransparency="true" onload="(function(e) { var event = new EBG.Events.Event(EBG.Events.EventNames.ELEMENT_LOADED);event.dispatcher = this;event.eventData = { DOMEvent: e, elementId: &quot;ebBannerIFrame_24907031_5179572172928602&quot;, adUId:&quot;24907031_5179572172928602&quot; };event.timing = EBG.Events.EventTiming.ONTIME_AND_AFTER;EBG.eventMgr.dispatchEvent(event);} )(typeof arguments != &quot;undefined&quot; ? arguments[0] : null);" style="border: 0px; padding: 0px; margin: 0px; left: 0px; top: 0px; width: 1400px; height: 1200px; z-index: 10000; clip: rect(auto auto auto auto); position: absolute;"></iframe>

2 个答案:

答案 0 :(得分:1)

的JavaScript:

document.getElementById('someID').style.zIndex = -1;

jQuery的:

$('someID').css('z-index', -1);

答案 1 :(得分:0)

这应该有效:

<iframe marginheight="0px" marginwidth="0px" frameborder="0" scrolling="no" id="ebBannerIFrame_24907031_5179572172928602" src="http://ds.serving-sys.com/BurstingRes//Site-2/WSFolders/3006392_201//index.html?v=_2_27_1_0" allowtransparency="true" onload="(function(e) { var event = new EBG.Events.Event(EBG.Events.EventNames.ELEMENT_LOADED);event.dispatcher = this;event.eventData = { DOMEvent: e, elementId: &quot;ebBannerIFrame_24907031_5179572172928602&quot;, adUId:&quot;24907031_5179572172928602&quot; };event.timing = EBG.Events.EventTiming.ONTIME_AND_AFTER;EBG.eventMgr.dispatchEvent(event);} )(typeof arguments != &quot;undefined&quot; ? arguments[0] : null);" style="border: 0px; padding: 0px; margin: 0px; left: 0px; top: 0px; width: 1400px; height: 1200px; z-index: -1; clip: rect(auto auto auto auto); position: absolute;"></iframe>