HI,
I want to call an method in Java Applet from java script, can anybody please help me out solving this problem.
Presently i am using following code but it is not working with IE but working with NEtscape
import java.lang.String;
public class test extends java.applet.Applet {
public static int countChars(String s) {
return s.length();
}
}
-------------------------------
And my HTML
-------------------------------
<HTML>
<HEAD>
<script language="Javascript">
function refreshApplet()
{
/* i = document.forms.myForm.TestApplet.countChars();
document.forms.myForm.output.value=i; */
document.forms.myForm.output.value=document.applets["TestApplet"].countChars(document.forms.myForm.input.value);
}
</script>
</HEAD>
<BODY>
<APPLET CODE = "test.class" WIDTH = 400 HEIGHT = 400 ALIGN = middle NAME = "TestApplet" scriptable="true">
</APPLET>
-------------------------------------
<br>
<form name="myForm">
<input type="text" name="input">
<input type="button" value="click me" onClick="refreshApplet();">
<hr>
<input type="text" name="output">
</form>
</BODY>
</HTML>
I want to call an method in Java Applet from java script, can anybody please help me out solving this problem.
Presently i am using following code but it is not working with IE but working with NEtscape
import java.lang.String;
public class test extends java.applet.Applet {
public static int countChars(String s) {
return s.length();
}
}
-------------------------------
And my HTML
-------------------------------
<HTML>
<HEAD>
<script language="Javascript">
function refreshApplet()
{
/* i = document.forms.myForm.TestApplet.countChars();
document.forms.myForm.output.value=i; */
document.forms.myForm.output.value=document.applets["TestApplet"].countChars(document.forms.myForm.input.value);
}
</script>
</HEAD>
<BODY>
<APPLET CODE = "test.class" WIDTH = 400 HEIGHT = 400 ALIGN = middle NAME = "TestApplet" scriptable="true">
</APPLET>
-------------------------------------
<br>
<form name="myForm">
<input type="text" name="input">
<input type="button" value="click me" onClick="refreshApplet();">
<hr>
<input type="text" name="output">
</form>
</BODY>
</HTML>