DOM的载荷加载Java小程序 [英] loading java applet on DOM load

查看:132
本文介绍了DOM的载荷加载Java小程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了很多,但也许我错了搜索字符​​串。一个Java applet投喂活位转换成我的网页,Java小程序访问我的网页上输入字段,并把信息

I searched for it a lot but probably I am searching wrong strings. A Java applet is feeding live bits into my pages, java applet accesses the input fields on my page and places the information

<input type="hidden" id="F1" value="Nothing Yet">

,然后调用JavaScript功能特征的页面说LivePicker(),然后它只是拿起一个值

and then it calls a javascript functionon the page say LivePicker() and then it simply picks up a value

var ClockVal = document.getElementById("F1").value;
document.getElementById("ICSCLOCK").innerHTML = ClockVal;

我现在面临的问题是,这工作得很好,但有时在Firebug的控制台它给像LivePicker的错误是没有定义,而LivePicker将工作完全正常的页面,而有时候它会给F1上没有定义的,而我的时钟是工作的罚款。所有这些错误的出现在页面加载。

The problem I am facing is, this works fine but sometimes in firebug console it give errors like LivePicker is not defined, while LivePicker would be working perfectly fine on the page while sometimes it will give F1 is not defined, while my clock would be working fine. All of these errors appear at page load.

Java小程序会将数据顺序,首先放置数据,然后调用JS函数来处理它。这工作完全正常的测试页以最小的HTML和JS,但是当我把它集成到我的应用程序,它使用了很多YUI组件和很多我自己的JS code的(这是现在很明显缩小的),它给这些错误。有一件事我想缩小前增加,这些错误了很多可能,但JS和CSS的微小后,页面加载时间减少到一半,这些错误的appearence减少到一半好。

Java applet places the data sequentially, it first place the data and then calls the js function to process it. That works perfectly fine on test pages with minimum HTML and JS but when I integrate it to my application, which uses a lot of components from YUI and a lot of my own JS code (which is now minified obviously), it give these errors. One thing I would like to add, before minification, these errors were a lot likely but after minification of JS and CSS, the page load time is reduced to half and the appearence of these errors are reduced to half as well.

我怀疑这是由于,在页面加载,小程序试图操纵DOM这还没有准备好。这有什么,这可能会停止Applet等到DOM满载?我试图在window.onload和YUI的onDOMReady功能,他们似乎就没有任何效果可言。

I am suspecting this is due to, on page load, applet tries to manipulate the DOM which is not ready yet. Is there anything, which could stop the applet to wait until the DOM is fully loaded? I tried window.onload and onDOMReady function of YUI, they seem to make no effect at all.

任何一个可以帮助吗?

推荐答案

您可以尝试使用的setTimeout拖延执行

you could try using setTimeout to delay execution

https://developer.mozilla.org/en/DOM/window.setTimeout

或jQuery库也可以帮帮忙,使用文档对象

or the jQuery library could also help out with the ready event on the document object

http://docs.jquery.com/Events/ready#fn

这篇关于DOM的载荷加载Java小程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆