0

我有一个包含 iframe 和 DHTML 日历小部件的网页。该页面以及 iframe 内的内容正确显示。问题是,当我激活距离 iframe 足够近的日历时,某些日历会被 iframe 隐藏。

我曾尝试通过同时使用 javascript 和 CSS(Zindex、z-index)来操纵 iframe 的定位,但 iframe 始终显示为页面上的最顶层,从而掩盖了与在同一区域呈现的任何父 DHTML 内容框架。我还将 DHTML 日历的 css 更改为值 > 0,并将小部件 scriplet 包装在具有高 z-index 值但没有运气的 div/span 中。

4

4 回答 4

0

The z-index of an iframe is handled in a weird way by IE. If you can get rid of it, I'd recommend you do and just embeded the content in a regular Div.

If you don't have other choices than do it like this, keep in mind that the z-index of elements like and will be infinite in IE6. So the way to stack that is to use iframes with higher zindexes, so that it will be infinity vs infinity+1.

An example of this is vs stacking. Both have infinite z-index, but you can stack them. Checkout Stu Nicholls code, that could be helpful.

That's pretty bad thought, my fix would be to avoid having other fields in this area.

于 2009-06-09T20:25:01.753 回答
0

You can definitely cover the iFrame with a div.

The thing is you can't use z-index unless you use position:relative, or position:absolute, or position: fixed on the calandar div.

What you want to do is change the "position" CSS property of the calandar to be "relative". If your iFrame has the normal static positioning (meaning you didn't add any special positioning to it, this will work).

If your iFrame has "absolute" positioning, you might need to do "position:absolute" on the calandar.

See link: http://resopollution.com/test/test.html

(works in all modern browsers including IE6)

于 2009-06-09T20:27:26.790 回答
0

Google for "IE z-index bug" for a variety of examples and solutions to similar problems. The html specification states that z-index should be absolute, but in IE it can be determined for an element if a parent element is positioned. In extreme circumstances, I've had to trace back up the DOM tree from the element that's causing problems and set the z-index attribute on whatever parent element has position, not on the element that is being obscured (and should rightfully have its z-index set). IE Developer toolbar can help for dynamic debugging if it's really a mess, just start setting the z-index properties up the tree until you find the one that makes it looks right.

于 2009-06-09T20:33:26.653 回答
0

我刚刚意识到问题似乎与 MSXML 以及 IE 如何转换 XML 文档有关。XML 有一个 XSLT 样式表关联,浏览器使用它来转换 XML 文档。转换的输出是一个 HTML 文档。我认为披露我的 HTTP 响应是 XML 并不重要,因为 HTML 是最终呈现的内容,但这确实很重要。当 IFRAME 的源是 HTML 文档时,一切正常。IFRAME 不涵盖 DHTML。但是,当使用 MSXML 转换 IFRAME 内容时,就会出现问题。下面是一些说明问题的示例文件。对于 DHTML 组件,我使用的是 spiffycalendar 小部件,但我想任何 DHTML 元素都会产生相同的结果。

父.HTML

IFRAME DHTML 冲突示例

                var pickupdate=new ctlSpiffyCalendarBox("pickupdate", "mainF", "PICKUP_DATE","btnDate1","",1);
            </script>

父窗口字段 FIELD FIELDpickupdate.writeControl(); FIELD FIELD FIELD 保存更改

IFRAME.HTML

IFRAME.XSL ]> 测试 XML 文档 IFRAME 内容

于 2009-06-09T23:40:57.663 回答