Closed
Bug 262416
Opened 20 years ago
Closed 20 years ago
Java applet code can't be called from a Javascript function if this function is called by onLoad event
Categories
(Core Graveyard :: Java: Live Connect, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: lorenzomiopalmo, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 Java applet code can't be called from a Javascript function if this function is called by onLoad event. This does not happen if the applet is run on a Click-buttun event. Reproducible: Always Steps to Reproduce: a sample Java applet contains only an init() method and another method called setString(), who draw a text "Hello World" in a box. When HTML page loading, a Javascript function call the Java method setString(). Actual Results: JavaScript error: appletBase.setString() is not a function. The Java method is not invoked. Expected Results: the text "Hello World" appears.
| Reporter | ||
Comment 1•20 years ago
|
||
see java code:
import java.applet.Applet;
import java.awt.Graphics;
public class HelloWorld extends Applet { String myString;
public void init() {
myString = new String("Init");
}
public void paint(Graphics g) {
g.drawString(myString, 25, 20);
}
public void setString(String aString) { myString = aString;
repaint(); }
}
see HTML+javascript:
<html>
<head>
<SCRIPT>
<!--- Hide script from old browsers
function getAppletBase() {
var appletBase;
appletBase = document.applets[0];
return appletBase;
}
function loadPage(pre) {
var appletBase = getAppletBase();
if(appletBase) {
if (pre) appletBase.setString(pre);
else appletBase.setString(" Hello World");
}
}
// end hiding from old browsers -->
</SCRIPT>
<body onLoad="loadPage()">
<APPLET CODE="HelloWorld.class" NAME="Hello" WIDTH=150 HEIGHT=25>
</APPLET>
<FORM NAME="form1">
<INPUT TYPE="button" VALUE="onClick"
onClick="loadPage(document.form1.id.value);"><BR>
<input type="hidden" name="id" value="C'est encore bon ?"></FORM>
</CENTER>
</body>
</html>Assignee: general → live-connect
Component: Browser-General → Java: Live Connect
QA Contact: general → pschwartau
Comment 2•20 years ago
|
||
I forgot to add that it happened 3 times since I installed Java 1.5.0 and _never_ before installing it. Previously I had Java 1.4.2_05
Comment 3•20 years ago
|
||
Ignore comment #2. Wrong bug!!!
| Reporter | ||
Comment 4•20 years ago
|
||
All is OK with a plug-in Java 1.5.0 !!!
| Reporter | ||
Updated•20 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•