Change ..
document.decisiontreeapplet
.. to ..
document.getElementById('decisiontreeapplet')
.. and this is likely to work.
eg.
HTML
<html> <body> <script type='text/javascript'> function callApplet() { msg = document.getElementById('input').value; applet = document.getElementById('output'); applet.setMessage(msg); } </script> <input id='input' type='text' size=20 onchange='callApplet()'> <br> <applet id='output' code='CallApplet' width=120 height=20> </applet> </body> </html>
Java
import javax.swing.*; public class CallApplet extends JApplet { JTextField output; public void init() { output = new JTextField(20); add(output); validate(); } public void setMessage(String message) { output.setText(message); } }
Please also consider posting a short complete example next time. Please note that the number of lines in the two sources shown above is shorter than yours, for example, the applet, and it took me longer to prepare the source so that I could check my answer.
source share