Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Applet launched from a Web base formular

Reply
Thread Tools

Applet launched from a Web base formular

 
 
Maldo
Guest
Posts: n/a
 
      02-27-2006
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
firefox doesn't show a formular lukas.zierer@gmail.com HTML 17 07-29-2006 10:41 AM
choice of URL and CD drive by formular Wanadoo HTML 0 06-18-2006 03:22 PM
can I applet be launched by another applet? (blank) hyena Java 2 07-01-2004 08:45 AM
HTML Formular question Clemens Richter HTML 1 11-07-2003 07:34 PM
force a formular just to take numbers Jochen Fuhrmann HTML 9 10-05-2003 09:55 PM



Advertisments