javascript加载Java小程序,高度设置为100%
我有一个显示java小程序的网页。如果使用JavaScript调整窗口的大小,则小程序的大小会调整,JavaScript工作正常。 小程序的宽度和高度设置为100%。加载小程序时,将显示一个图像
image = "preloader.gif"
使用IE 6/7,一切正常。但在Firefox中,小程序的高度约为200像素。宽度在100%时是正确的。因此,预加载程序图像被切成两半。加载小程序并且javascript调整页面大小后,正确设置宽度和高度
如果更改HTML代码并为小程序使用固定大小,则在加载过程中对象显示正确,但之后无法调整大小
这个问题有什么解决办法吗
谢谢, 丹尼尔
ps我使用的是Object/embed标记,但是如果我使用applet标记,问题是相同的
# 1 楼答案
我也有同样的问题,我找不到答案,但我找到了解决办法。 您必须将小程序代码嵌入Javascript函数中,并在加载页面后不久将其填充到正文的innerHtml中(或在任何您想使用小程序的地方)。所以
对答案的任何补充都有帮助:-)
# 2 楼答案
我建议您实现一个基于CSS的解决方案,并创建大小为
100%
的小程序。我使用这种方法,它简单,可靠,跨浏览器。你有什么理由不能这样做吗# 3 楼答案
不看这一页很难说。一种可能是在javascript运行之前加载小程序。在这种情况下,您可以尝试使用javascript加载小程序(而不是直接在html中进行编码)
# 4 楼答案
我在Firefox和Opera中得到了同样的短而宽的applet
现在,我动态创建小程序,这允许我根据视口大小计算其包含div的大小。这让我相信,如果您使用的包含div的大小是以点为单位指定的,而不是以100%为单位,那么您将得到您想要的
我用来创建小程序的代码
在http://books.verg.es/elements_of_ux.html?format=java运行的代码