如何显示&LT; DIV&GT;在Chrome浏览器中的Java小程序 [英] How to display <div> over a Java applet in Chrome
问题描述
我嵌入iframe元素在我的HTML页面:
I embed iframe element in my HTML page:
<iframe src="applet.html" frameborder="0" style="width: 600px; height: 600px;"></iframe>
applet.html看起来是这样的:
applet.html looks like this:
<html>
<head>
</head>
<body>
<applet code="ClockApplet.class" width="100%" height="100%">
</applet>
</body>
</html>
问题是:如何显示的div元素(位置:绝对)。在一个Java小程序是里面的iframe
The problem is: how to display a div element (with position: absolute) over a Java applet which is inside iframe.
我试图用另一个iframe元素:
I tried to use another iframe element:
<html>
<head>
</head>
<body>
<iframe src="applet.html" frameborder="0" style="width: 600px; height: 600px;"></iframe>
<iframe src="javascript:false;" frameborder="0" style="position: absolute; top: 10px; left: 10px; width: 150px; height: 150px; z-index: 99"></iframe>
<div style="position: absolute; top: 10px; left: 10px; background-color: gray; height: 150px; width: 150px; z-index: 100">Hello World</div>
</body>
</html>
在IE,Firefox的罚款,但没有在Chrome中。
Works fine in IE, Firefox but not in Chrome.
推荐答案
我发现,似乎提供了一个解决方案的文章,所以我不会邀功的未来与它:
I found an article that seems to provide a solution, so I'll not claim the credit for coming up with it:
<一个href=\"http://www.oratransplant.nl/2007/10/26/using-iframe-shim-to-partly-cover-a-java-applet/\">http://www.oratransplant.nl/2007/10/26/using-iframe-shim-to-partly-cover-a-java-applet/
从文章:
的解决方案是具有第三的iFrame
A.的iFrame的iframe℃以内C具有
iframe中是在较高的z-index
比小程序的z-index的。它是
定位,它的矩形作为
审议了顶页面
相同的,在iframe的B
覆盖。
The solution is to have a third Iframe C within Iframe A. Iframe C has a z-index within Iframe A that is higher than the z-index of the Applet. It is positioned so that it's rectangle as considered by the top page is identical to that of the Iframe B overlay.
我粘贴第二的IFrame code从主页进入applet.html像这样:
I pasted second IFrame code from your main page into applet.html like so:
<iframe src="javascript:false;" frameborder="0" style="position: absolute; top: 10px; left: 10px; width: 150px; height: 150px; z-index: 1"></iframe>
<applet code="ClockApplet.class" width="100%" height="100%">
</applet>
和它似乎做的伎俩铬。
我没有得到一个框架的边界,但我猜这是可以解决的。搏一搏。
I did get a frame border but i'm guessing this is fixable. Give it a go.
这篇关于如何显示&LT; DIV&GT;在Chrome浏览器中的Java小程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!