如何在 <div> Chrome 中的 Java 小程序上显示



我在HTML页面中嵌入iframe元素:

<iframe src="applet.html" frameborder="0" style="width: 600px; height: 600px;"></iframe>

apple.html看起来像这样:

<html>
<head>
</head>
<body>
    <applet code="ClockApplet.class" width="100%" height="100%">
    </applet>
</body>
</html>

问题是:如何在iframe中的Java小程序上显示div元素(位置:absolute)。

我尝试使用另一个iframe元素:

<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。

我发现了一篇文章,它似乎提供了一个解决方案,所以我不会因为提出它而获得赞誉:

http://www.oratransplant.nl/2007/10/26/using-iframe-shim-to-partly-cover-a-java-applet/

来自文章:

解决方案是使用第三个IframeIframe A中的C。Iframe C具有Iframe A中较高的z索引而不是Applet的z索引。是的定位为矩形首页考虑的是与Iframe B的相同覆盖

我把你主页上的第二个IFrame代码粘贴到了applet.html中,如下所示:

<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>

它似乎在铬合金中发挥了作用。

我确实得到了一个框架边界,但我猜这是可以修复的。试试看。

这个问题通过最新的更新得到了部分解决,至少在MacOSX:上是这样

我在一个小程序上测试了具有不透明度、阴影和圆角等花哨CSS效果的DIV,它在Safari、Firefox 11和Chrome 19中运行良好:构图没有问题,没有故障。。没有iframes!

不过,它在Ubuntu上仍然是坏的。真是令人沮丧。我不知道是否适用于Windows?

最新更新