Applet launched from a Web base formular

M

Maldo

Hi every body

I'm coding a small applet wich specific function must be executed from a Web
base formular (HTML & Javascript code)
I'm using JRE 1.5 & the following HTML code:

<html>
<head>
<title>Test </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#E9D8C8">
<h1> AppletTest </h1>

<DIV id="dvObjectHolder">Applet comes here</DIV>
<br><br>

<script language="JavaScript">
var _info = navigator.userAgent;
var _ns = (navigator.appName.indexOf("Netscape") >= 0
&& ((_info.indexOf("Win") > 0
&& _info.indexOf("Win16") < 0
&& java.lang.System.getProperty("os.version").indexOf("3.5") < 0)
|| (_info.indexOf("Sun") > 0)
|| (_info.indexOf("Linux") > 0)));
var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0));
var _ie = (_info.indexOf("MSIE") > 0
&& _info.indexOf("Win") > 0
&& _info.indexOf("Windows 3.1") < 0);
</script>
<script language="JavaScript">
function testit() {
document.getElementById('lblOutputText').innerHTML =
document.appletTest1.test();
}

if (_ie == true)
document.writeln('<OBJECT
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" name="appletTest1"
width="100" height="50"> <PARAM name="code" value="Test.class"> <PARAM
NAME="archive" VALUE="applet.jar"> </OBJECT>');
else if (_ns == true && _ns6)
document.writeln('<EMBED code="Test.class" name="appletTest1"
width="100" height="50" type="application/x-java-applet;version=1.5"
ARCHIVE="applet.jar"
pluginspage="http://java.sun.com/j2se/1.5.0/download.html"></EMBED>');
</script>

<label id="lblOutputText">This text will be replaced by the applet</label>
<br><br>
<input value="Click" type=button onClick="testit()"><br>


</body>
</html>


I'm running this script under the following navigators:
- Internet Explorer v6.0
- Firefox v1.5

The Test class has 2 functions init() & test().
test() only returns a "Hello World" string.
init() Applet default function launch test(), When the web page & the applet
are loaded, I have the "Hello World" string displayed in the HTML label.
But when I click on the "Click" button i get a Javascript error on Firefox
(ans IE) saying that "document.appletTest1.test is not a function"

I've already done such tricks but using JRE 1.3 ... is there something
changed in JRE 1.4 or JRE 1.5 ??
What i've done wrong ?

Thanks for help :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top