简体   繁体   English

Javascript 弹出页面使文本在 Internet Explorer 中不可见

[英]Javascript Pop Up Page Makes Text Invisible In Internet Explorer

I'm working on a project at the moment where I've come up against a rather frustrating problem in Internet Explorer.我正在做一个项目,在这个项目中我遇到了 Internet Explorer 中一个相当令人沮丧的问题。 I have a series of pop ups on a particular page that are opened with JavaScript when help links are clicked.我在特定页面上有一系列弹出窗口,当单击帮助链接时,这些窗口会使用 JavaScript 打开。 The JavaScript for them is:他们的 JavaScript 是:

function openHelpPopUp(url) {
    newwindow=window.open(url,'name','width=620,height=440');
    if (window.focus) {newwindow.focus()}
    return false;
}

The HTML used is:使用的 HTML 是:

<a href="help.html" onclick="return openHelpPopUp('help.html')" title="More information" class="help-popup-link">Help</a>

Now, the pop up works perfectly in every browser except Internet Explorer.现在,弹出窗口在除 Internet Explorer 之外的所有浏览器中都能完美运行。 The main priority at the moment is making it work in IE7.目前的主要优先事项是使其在 IE7 中工作。

What happens is that, it pops up fine, but the text is not visible.发生的情况是,它弹出得很好,但文本不可见。 If you click and drag the cursor over it and highlight it though, it becomes visible.如果您单击并将光标拖到它上面并突出显示它,它就会变得可见。 Once you click away from the highlighted area to deselect it, it stays visible.一旦您在突出显示的区域之外单击以取消选择它,它就会保持可见。 Any area that wasn't highlighted stays invisible.任何未突出显示的区域保持不可见。 When you refresh the pop up though, it sometimes becomes visible without any highlighting, it sometimes doesn't.但是,当您刷新弹出窗口时,它有时会在没有任何突出显示的情况下变得可见,有时则不会。

Also peculiar is that some text within an unordered list is visible, but when I use the same list encompass the rest of the text, it stays invisible bar the bit that was already visible.同样奇怪的是,无序列表中的某些文本是可见的,但是当我使用相同的列表包含文本的其余部分时,它会保持不可见,除非已经可见。

Have you come across this or anything like it before?你以前遇到过这个或类似的事情吗? Have you got any tips or suggestions?你有什么提示或建议吗? I'm running out of things to try so any feedback or help on this is greatly appreciated!我已经没有什么可以尝试的了,因此非常感谢您对此的任何反馈或帮助!

By adding a z-index of 100 to every P tag for IE, I seem to have gotten it visible now.通过为 IE 的每个 P 标签添加 100 的 z-index,我现在似乎已经看到它了。 Weird.奇怪的。 I haven't used any z-index's elsewhere and the structure of the HTML should put the P's on the top anyway.我没有在其他地方使用任何 z-index 并且 HTML 的结构无论如何都应该将 P 放在顶部。

Sounds like a browser bug.听起来像是浏览器错误。

What happens if you open the URL directly?如果直接打开 URL 会发生什么? Perhaps it's not popup related?也许它与弹出窗口无关?

it pops up fine, but the text is not visible.它弹出很好,但文本不可见。 If you click and drag the cursor over it and highlight it though, it becomes visible如果您单击并将光标拖到它上面并突出显示它,它就会变得可见

Sounds like it might be an IE7 variant Peekaboo bug , an IE rendering problem which is nothing to do with being opened in a pop-up.听起来可能是IE7 变体Peekaboo bug ,一个与在弹出窗口中打开无关的 IE 渲染问题。 You'd have to show us the page that's being popped up to be sure though.您必须向我们展示正在弹出的页面才能确定。

Whilst we're here:虽然我们在这里:

if (window.focus) {newwindow.focus()}如果(window.focus){newwindow.focus()}

Probably should be 'if (newwindow.focus)' assuming the aim is to avoid focusing a blocked 'window.open()=null'.可能应该是 'if (newwindow.focus)' 假设目的是避免聚焦阻塞的 'window.open()=null'。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM